richmemo: clarification of rules on line spacing

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3767 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
skalogryz
2014-11-22 08:39:39 +00:00
parent 9dba703693
commit 592e08affc
2 changed files with 12 additions and 4 deletions

View File

@ -333,7 +333,7 @@ begin
AMetric.FirstLine:=attr^.indent*PixToPt; AMetric.FirstLine:=attr^.indent*PixToPt;
AMetric.HeadIndent:=attr^.left_margin*PixToPt; AMetric.HeadIndent:=attr^.left_margin*PixToPt;
AMetric.TailIndent:=attr^.right_margin*PixToPt; AMetric.TailIndent:=attr^.right_margin*PixToPt;
AMetric.LineSpacing:=(attr^.pixels_inside_wrap*PixToPt+fp.Size*1.2)/(fp.Size*1.2); AMetric.LineSpacing:=(attr^.pixels_inside_wrap*PixToPt+fp.Size)/(fp.Size);
gtk_text_attributes_unref(attr); gtk_text_attributes_unref(attr);
end; end;
end; end;
@ -384,7 +384,7 @@ begin
'right-margin-set', gboolean(gTRUE), 'right-margin-set', gboolean(gTRUE),
'indent', gint(round(fl*DPIFactor)), 'indent', gint(round(fl*DPIFactor)),
'indent-set', gboolean(gTRUE), 'indent-set', gboolean(gTRUE),
'pixels-inside-wrap', gint(round(fp.Size*1.2*(AMetric.LineSpacing-1)*DPIFactor)), 'pixels-inside-wrap', gint(round(fp.Size*(AMetric.LineSpacing-1)*DPIFactor)),
'pixels-inside_wrap-set', gboolean(gTRUE), 'pixels-inside_wrap-set', gboolean(gTRUE),
nil]); nil]);
ApplyTag(buffer, tag, TextStart, TextLen, true); ApplyTag(buffer, tag, TextStart, TextLen, true);

View File

@ -41,8 +41,14 @@ type
HeadIndent : Double; // in points HeadIndent : Double; // in points
SpaceBefore : Double; // in points SpaceBefore : Double; // in points
SpaceAfter : Double; // in points SpaceAfter : Double; // in points
LineSpacing : Double; // multi LineSpacing : Double; // multiplier - matching CSS line-height by percentage/em
// note, that normal LineSpacing is 1.2, not 1.0
end; end;
const
DefLineSpacing = 1.2;
type
TParaNumStyle = (pnNone, pnBullet, pnNumber, pnLowLetter TParaNumStyle = (pnNone, pnBullet, pnNumber, pnLowLetter
, pnLowRoman, pnUpLetter, pnUpRoman, pnCustomChar); , pnLowRoman, pnUpLetter, pnUpRoman, pnCustomChar);
@ -54,6 +60,8 @@ type
TTextModifyMask = set of (tmm_Color, tmm_Name, tmm_Size, tmm_Styles); TTextModifyMask = set of (tmm_Color, tmm_Name, tmm_Size, tmm_Styles);
type
TRichMemoObject = class(TObject); TRichMemoObject = class(TObject);
{ TCustomRichMemo } { TCustomRichMemo }
@ -205,7 +213,7 @@ end;
procedure InitParaMetric(var m: TParaMetric); procedure InitParaMetric(var m: TParaMetric);
begin begin
FillChar(m, sizeof(m), 0); FillChar(m, sizeof(m), 0);
m.LineSpacing:=1.0; m.LineSpacing:=DefLineSpacing;
end; end;
procedure InitParaNumbering(var n: TParaNumbering); procedure InitParaNumbering(var n: TParaNumbering);