@@ -45,6 +45,7 @@ TextField::TextField(bool inInitRef) : DisplayObject(inInitRef),
45
45
sharpness(0 ),
46
46
textColor(0x000000 ),
47
47
thickness(0 ),
48
+ lineSpaceScale(1 .0f ),
48
49
useRichTextClipboard(false ),
49
50
wordWrap(false ),
50
51
isInput(false )
@@ -301,6 +302,16 @@ void TextField::setAntiAliasType(int inVal)
301
302
}
302
303
303
304
305
+ void TextField::setLineSpaceScale (double inScale)
306
+ {
307
+ if (lineSpaceScale!=inScale)
308
+ {
309
+ lineSpaceScale = (float )inScale;
310
+ Layout ();
311
+ }
312
+ }
313
+
314
+
304
315
void TextField::setTextColor (int inCol)
305
316
{
306
317
textColor = inCol;
@@ -2233,9 +2244,10 @@ void TextField::Layout(const Matrix &inMatrix, const RenderTarget *inTarget)
2233
2244
if (ch==' \n ' || ch==' \r ' )
2234
2245
{
2235
2246
// New line ...
2236
- line.mMetrics .fontToLocal (fontToLocal);
2247
+ line.mMetrics .fontToLocal (fontToLocal*lineSpaceScale );
2237
2248
if (i+1 <mCharGroups .size () || cid+1 <g.Chars ())
2238
2249
line.mMetrics .height += g.mFormat ->leading ;
2250
+
2239
2251
charY += line.mMetrics .height ;
2240
2252
mLines .push_back (line);
2241
2253
line.Clear ();
@@ -2281,7 +2293,7 @@ void TextField::Layout(const Matrix &inMatrix, const RenderTarget *inTarget)
2281
2293
line.mChars = last_word_line_chars;
2282
2294
line.mMetrics .width = last_word_x;
2283
2295
}
2284
- line.mMetrics .fontToLocal (fontToLocal);
2296
+ line.mMetrics .fontToLocal (fontToLocal*lineSpaceScale );
2285
2297
if (i+1 <mCharGroups .size () || cid+1 <g.Chars ())
2286
2298
line.mMetrics .height += g.mFormat ->leading ;
2287
2299
charY += line.mMetrics .height ;
@@ -2302,7 +2314,7 @@ void TextField::Layout(const Matrix &inMatrix, const RenderTarget *inTarget)
2302
2314
{
2303
2315
CharGroup *last=mCharGroups [mCharGroups .size ()-1 ];
2304
2316
last->UpdateMetrics (line.mMetrics );
2305
- line.mMetrics .fontToLocal (fontToLocal);
2317
+ line.mMetrics .fontToLocal (fontToLocal*lineSpaceScale );
2306
2318
if (endsWidthNewLine)
2307
2319
{
2308
2320
line.mY0 = charY;
@@ -2430,6 +2442,7 @@ void TextField::decodeStream(ObjectStreamIn &stream)
2430
2442
stream.get (sharpness);
2431
2443
stream.get (textColor);
2432
2444
stream.get (thickness);
2445
+ stream.get (lineSpaceScale);
2433
2446
stream.get (useRichTextClipboard);
2434
2447
stream.get (wordWrap);
2435
2448
stream.get (isInput);
@@ -2489,6 +2502,7 @@ void TextField::encodeStream(ObjectStreamOut &stream)
2489
2502
stream.add (sharpness);
2490
2503
stream.add (textColor);
2491
2504
stream.add (thickness);
2505
+ stream.add (lineSpaceScale);
2492
2506
stream.add (useRichTextClipboard);
2493
2507
stream.add (wordWrap);
2494
2508
stream.add (isInput);
0 commit comments