Ignore:
Timestamp:
09/13/18 12:30:53 (6 years ago)
Author:
bln4
Message:

org.apollo.items.EmulatedTextItem ->
org.expeditee.agents.GraphFramesetLinks ->
org.expeditee.gio.FontManager ->
org.expeditee.gio.javafx.JavaFXFontManager ->
org.expeditee.gio.swing.SwingFontManager ->
org.expeditee.gui.MessageBay ->
org.expeditee.io.WebParser ->
org.expeditee.items.Text ->

The above files are been altered so that there is no longer any chance Font references will be shared amongst Text Items. How default Fonts are used has been altered so that a Text Item using the default font remember that this is the case. This is a follow up to an initial fix for the same problem that turned out to be insufficient.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/items/Text.java

    r1116 r1125  
    979979                        // if a rebuild is required
    980980                        rebuild(true, false);
    981 
     981                       
    982982                        // determine the new position the cursor should have
    983983                        for (int i = 0; i < _textLayouts.size(); i++) {
     
    992992
    993993                        if (newLine == lineIndex) {
     994//                              System.err.println("newLine == lineIndex");
    994995                                if (insertionIndex > 0)
    995996                                        hit = current.getNextRightHit(insertionIndex - 1);
     
    10081009                float[] caret = current.getCaretInfo(hit);
    10091010                float y = getLineDrop(current) * lineIndex;
     1011                y = getY() + y + caret[1];
    10101012
    10111013                float x = getX() + caret[0] + getJustOffset(current);
    1012                 x = Math.min(
    1013                                                 x,
    1014                                                 (getX() - Item.MARGIN_RIGHT - (2 * getGravity()) + getBoundsWidth())
    1015                 );
    1016 
    1017                 invalidateAll();
    1018 
    1019                 return new Point(Math.round(x), Math.round(getY() + y + caret[1]));
     1014                x = Math.min(x, (getX() - Item.MARGIN_RIGHT - (2 * getGravity()) + getBoundsWidth()));
     1015
     1016                invalidateAll();
     1017               
     1018//              System.err.println("Mouse location: " + mouseX + "," + mouseY);
     1019//              System.err.println("Caret location: " + caret[0] + "," + caret[1]);
     1020
     1021//              System.err.println(text);
     1022//              System.err.println("X delta: " + (x - getX()));
     1023                final Point newCursor = new Point(Math.round(x), Math.round(y));
     1024//              System.err.println("Moving cursor to: " + newCursor);
     1025                return newCursor;
    10201026        }
    10211027
     
    12231229        {
    12241230                invalidateAll();
    1225                 // all decoding occurs in the Utils class
     1231               
    12261232                _font = font;
    1227                 // rejustify();
     1233
    12281234                rebuild(false);
    12291235
     
    12471253        public Font getPaintFont()
    12481254        {
    1249                 if (getFont() == null) {
    1250                         return EcosystemManager.getFontManager().getDefaultFont().clone();
    1251                 }
    1252                 return getFont();
     1255                final Font f = getFont();
     1256                if (f == null) {
     1257                        _font = EcosystemManager.getFontManager().getDefaultFont().clone();
     1258                        return _font;
     1259                }
     1260                return f;
    12531261        }
    12541262
     
    13241332                Font currentFont = getPaintFont();
    13251333                currentFont.toggleBold();
    1326                 setFont(currentFont);
     1334                //setFont(currentFont);
    13271335                rebuild(true);
    13281336                invalidateAll();
     
    13331341                Font currentFont = getPaintFont();
    13341342                currentFont.toggleItalic();
    1335                 setFont(currentFont);
     1343                //setFont(currentFont);
    13361344                rebuild(true);
    13371345                invalidateAll();
     
    13431351                if (newFace == null || newFace.trim().length() == 0) {
    13441352                        currentFont.setStyle(Font.Style.PLAIN);
    1345                         setFont(currentFont);
     1353                        //setFont(currentFont);
    13461354                        return;
    13471355                }
     
    13591367                }
    13601368               
    1361                 setFont(currentFont);
     1369                //setFont(currentFont);
    13621370
    13631371        }
     
    14781486                Font currentFont = getPaintFont();
    14791487                currentFont.setSpacing(spacing);
    1480                 setFont(currentFont);
     1488                //setFont(currentFont);
    14811489        }
    14821490
     
    19161924                                fill = null;
    19171925                        }
     1926//                      System.err.println("Top left: " + getBoundingBox().getTopLeft() + ", " + "Bottom right: " + getBoundingBox().getBottomRight());
    19181927                        g.drawRectangle(bounds, 0.0, fill, getPaintHighlightColor(), highlightStroke, null);
    19191928                }
     
    19891998                copy.setWordSpacing(getWordSpacing());
    19901999                copy.setWidth(getWidthToSave());
    1991                 copy.setFont(getFont());
     2000                copy.setFont(getFont().clone());
    19922001                if (hasFormula()) {
    19932002                        copy.calculate(getFormula());
     
    20252034                Font currentFont = getPaintFont();
    20262035                currentFont.setSize((int) size);
    2027                 setFont(currentFont);
     2036                //setFont(currentFont);
    20282037                rebuild(true);
    20292038                invalidateAll();
Note: See TracChangeset for help on using the changeset viewer.