Skip to content

Commit 2324fbc

Browse files
committed
Define correct style default for leading.
1 parent 922f224 commit 2324fbc

1 file changed

Lines changed: 39 additions & 39 deletions

File tree

src/style/Style.js

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -68,49 +68,49 @@
6868
var Style = Base.extend(new function() {
6969
// windingRule / resolution / fillOverprint / strokeOverprint are currently
7070
// not supported.
71-
var defaults = {
72-
// Paths
73-
fillColor: undefined,
74-
strokeColor: undefined,
75-
strokeWidth: 1,
76-
strokeCap: 'butt',
77-
strokeJoin: 'miter',
78-
miterLimit: 10,
79-
dashOffset: 0,
80-
dashArray: [],
81-
// Shadows
82-
shadowColor: undefined,
83-
shadowBlur: 0,
84-
shadowOffset: new Point(),
85-
// Selection
86-
selectedColor: undefined,
87-
// Characters
88-
font: 'sans-serif',
89-
fontSize: 12,
90-
leading: null,
91-
// Paragraphs
92-
justification: 'left'
93-
};
94-
95-
var flags = {
96-
strokeWidth: /*#=*/ Change.STROKE,
97-
strokeCap: /*#=*/ Change.STROKE,
98-
strokeJoin: /*#=*/ Change.STROKE,
99-
miterLimit: /*#=*/ Change.STROKE,
100-
font: /*#=*/ Change.GEOMETRY,
101-
fontSize: /*#=*/ Change.GEOMETRY,
102-
leading: /*#=*/ Change.GEOMETRY,
103-
justification: /*#=*/ Change.GEOMETRY
104-
};
105-
106-
var item = {},
71+
var fontSize = 12,
72+
leadingFactor = 1.2,
73+
defaults = {
74+
// Paths
75+
fillColor: undefined,
76+
strokeColor: undefined,
77+
strokeWidth: 1,
78+
strokeCap: 'butt',
79+
strokeJoin: 'miter',
80+
miterLimit: 10,
81+
dashOffset: 0,
82+
dashArray: [],
83+
// Shadows
84+
shadowColor: undefined,
85+
shadowBlur: 0,
86+
shadowOffset: new Point(),
87+
// Selection
88+
selectedColor: undefined,
89+
// Characters
90+
font: 'sans-serif',
91+
fontSize: fontSize,
92+
leading: fontSize * leadingFactor,
93+
// Paragraphs
94+
justification: 'left'
95+
},
96+
flags = {
97+
strokeWidth: /*#=*/ Change.STROKE,
98+
strokeCap: /*#=*/ Change.STROKE,
99+
strokeJoin: /*#=*/ Change.STROKE,
100+
miterLimit: /*#=*/ Change.STROKE,
101+
font: /*#=*/ Change.GEOMETRY,
102+
fontSize: /*#=*/ Change.GEOMETRY,
103+
leading: /*#=*/ Change.GEOMETRY,
104+
justification: /*#=*/ Change.GEOMETRY
105+
},
107106
fields = {
108107
_defaults: defaults,
109108
// Override default fillColor for text items
110109
_textDefaults: Base.merge(defaults, {
111110
fillColor: new Color() // black
112111
})
113-
};
112+
},
113+
item = {};
114114

115115
Base.each(defaults, function(value, key) {
116116
var isColor = /Color$/.test(key),
@@ -236,9 +236,9 @@ var Style = Base.extend(new function() {
236236
},
237237

238238
getLeading: function getLeading() {
239-
// Override leading to return fontSize * 1.2 by default.
239+
// Override leading to return fontSize * leadingFactor by default.
240240
var leading = getLeading.base.call(this);
241-
return leading != null ? leading : this.getFontSize() * 1.2;
241+
return leading != null ? leading : this.getFontSize() * leadingFactor;
242242
},
243243

244244
getFontStyle: function() {

0 commit comments

Comments
 (0)