Ignore:
Timestamp:
01/07/14 15:26:22 (10 years ago)
Author:
ngw8
Message:

Improvements WebParser conversions of wrapped text - links and other formatting now maintained. Fixed inability to have negative letter spacing, doesn't seem to have broken anything. Changed text line spacing to be a float.

File:
1 edited

Legend:

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

    r655 r659  
    3939import org.expeditee.gui.FreeItems;
    4040import org.expeditee.math.ExpediteeJEP;
     41import org.expeditee.settings.UserSettings;
    4142import org.expeditee.settings.experimental.ExperimentalFeatures;
    4243import org.nfunk.jep.Node;
     
    112113        private Justification _justification = Justification.left;
    113114
    114         private int _spacing = -1;
     115        private float _spacing = -1;
    115116
    116117        private int _word_spacing = -1;
    117118
    118         private int _initial_spacing = -1;
    119 
    120         private int _letter_spacing = -1;
     119        private float _initial_spacing = 0;
     120
     121        private float _letter_spacing = 0;
    121122
    122123        // used during ranging out
     
    11921193         *            The number of pixels to allow between each line
    11931194         */
    1194         public void setSpacing(int spacing) {
     1195        public void setSpacing(float spacing) {
    11951196                _spacing = spacing;
    11961197                updatePolygon();
     
    12021203         * @return The spacing (inter-line) in pixels of this Text.
    12031204         */
    1204         public int getSpacing() {
     1205        public float getSpacing() {
    12051206                return _spacing;
    12061207        }
     
    12281229         *            Additional spacing to add between letters. See {@link java.awt.font.TextAttribute#TRACKING}
    12291230         */
    1230         public void setLetterSpacing(int spacing) {
     1231        public void setLetterSpacing(float spacing) {
    12311232                _letter_spacing = spacing;
    12321233                HashMap<TextAttribute, Object> attr = new HashMap<TextAttribute, Object>();
    12331234                attr.put(TextAttribute.TRACKING, spacing);
    1234                 this._font = this._font.deriveFont(attr);
     1235               
     1236                if (this._font == null) {
     1237                        this._font = Font.decode(DEFAULT_FONT);
     1238                }
     1239
     1240                this.setFont(this._font.deriveFont(attr));
    12351241        }
    12361242
     
    12381244         * @return The spacing (proportional to the font size) between letters. See {@link java.awt.font.TextAttribute#TRACKING}
    12391245         */
    1240         public int getLetterSpacing() {
     1246        public float getLetterSpacing() {
    12411247                return _letter_spacing;
    12421248        }
    12431249
    1244         public void setInitialSpacing(int spacing) {
     1250        public void setInitialSpacing(float spacing) {
    12451251                _initial_spacing = spacing;
    12461252        }
    12471253
    1248         public int getInitialSpacing() {
     1254        public float getInitialSpacing() {
    12491255                return _initial_spacing;
    12501256        }
Note: See TracChangeset for help on using the changeset viewer.