mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 14:09:20 +02:00
* Fix range check error (bug ID 35251)
git-svn-id: trunk@41799 -
This commit is contained in:
parent
d66e959ad7
commit
ebf8ab979c
@ -1687,14 +1687,30 @@ var
|
|||||||
s: string;
|
s: string;
|
||||||
lst: TTextMappingList;
|
lst: TTextMappingList;
|
||||||
lFont: TTFFileInfo;
|
lFont: TTFFileInfo;
|
||||||
|
lWidthIndex: integer;
|
||||||
begin
|
begin
|
||||||
s := '';
|
s := '';
|
||||||
lst := Document.Fonts[EmbeddedFontNum].TextMapping;
|
lst := Document.Fonts[EmbeddedFontNum].TextMapping;
|
||||||
lst.Sort;
|
lst.Sort;
|
||||||
lFont := Document.Fonts[EmbeddedFontNum].FTrueTypeFile;
|
lFont := Document.Fonts[EmbeddedFontNum].FTrueTypeFile;
|
||||||
// use decimal values for the output
|
|
||||||
|
{$IFDEF gdebug}
|
||||||
|
System.WriteLn('****** isFixedPitch = ', BoolToStr(lFont.PostScript.isFixedPitch > 0, True));
|
||||||
|
System.WriteLn('****** Head.UnitsPerEm := ', lFont.Head.UnitsPerEm );
|
||||||
|
System.WriteLn('****** HHead.numberOfHMetrics := ', lFont.HHead.numberOfHMetrics );
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{ NOTE: Monospaced fonts may not have a width for every glyph
|
||||||
|
the last one is for subsequent glyphs. }
|
||||||
for i := 0 to lst.Count-1 do
|
for i := 0 to lst.Count-1 do
|
||||||
s := s + Format(' %d [%d]', [ lst[i].GlyphID, TTTFFriendClass(lFont).ToNatural(lFont.Widths[lst[i].GlyphID].AdvanceWidth)]);
|
begin
|
||||||
|
if lst[i].GlyphID < lFont.HHead.numberOfHMetrics then
|
||||||
|
lWidthIndex := lst[i].GlyphID
|
||||||
|
else
|
||||||
|
lWidthIndex := lFont.HHead.numberOfHMetrics-1;
|
||||||
|
s := s + Format(' %d [%d]', [lst[i].GlyphID, TTTFFriendClass(lFont).ToNatural(lFont.Widths[lWidthIndex].AdvanceWidth)])
|
||||||
|
end;
|
||||||
|
|
||||||
WriteString(s, AStream);
|
WriteString(s, AStream);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user