Pārlūkot izejas kodu

* fixed some bugs in free type impl.

master
Bergmann89 pirms 11 gadiem
vecāks
revīzija
c68be04283
6 mainītis faili ar 249 papildinājumiem un 136 dzēšanām
  1. +0
    -4
      examples/simple/TextSuiteTest.lpi
  2. +101
    -99
      examples/simple/TextSuiteTest.lps
  3. +8
    -8
      examples/simple/uMainForm.pas
  4. +23
    -12
      utsFontCreatorFreeType.pas
  5. +116
    -12
      utsFreeType.pas
  6. +1
    -1
      utsTextSuite.pas

+ 0
- 4
examples/simple/TextSuiteTest.lpi Parādīt failu

@@ -49,7 +49,6 @@
<Unit2>
<Filename Value="..\..\utsRendererOpenGL.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="utsRendererOpenGL"/>
</Unit2>
<Unit3>
<Filename Value="..\..\utsTextSuite.pas"/>
@@ -68,7 +67,6 @@
<Unit6>
<Filename Value="..\..\utsUtils.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="utsUtils"/>
</Unit6>
<Unit7>
<Filename Value="..\..\utsFontCreatorGDI.pas"/>
@@ -78,12 +76,10 @@
<Unit8>
<Filename Value="..\..\utsCodePages.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="utsCodePages"/>
</Unit8>
<Unit9>
<Filename Value="..\..\utsPostProcess.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="utsPostProcess"/>
</Unit9>
<Unit10>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>


+ 101
- 99
examples/simple/TextSuiteTest.lps Parādīt failu

@@ -10,7 +10,7 @@
<IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
<CursorPos X="29" Y="20"/>
<UsageCount Value="134"/>
<UsageCount Value="138"/>
</Unit0>
<Unit1>
<Filename Value="uMainForm.pas"/>
@@ -19,37 +19,35 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="uMainForm"/>
<IsVisibleTab Value="True"/>
<TopLine Value="74"/>
<CursorPos X="31" Y="90"/>
<UsageCount Value="134"/>
<TopLine Value="42"/>
<CursorPos X="26" Y="59"/>
<UsageCount Value="138"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
<Unit2>
<Filename Value="..\..\utsRendererOpenGL.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="utsRendererOpenGL"/>
<EditorIndex Value="-1"/>
<TopLine Value="494"/>
<CursorPos Y="522"/>
<UsageCount Value="62"/>
<UsageCount Value="66"/>
</Unit2>
<Unit3>
<Filename Value="..\..\utsTextSuite.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="utsTextSuite"/>
<EditorIndex Value="3"/>
<TopLine Value="1335"/>
<CursorPos X="3" Y="1405"/>
<UsageCount Value="62"/>
<TopLine Value="1392"/>
<CursorPos Y="1405"/>
<UsageCount Value="66"/>
<Loaded Value="True"/>
</Unit3>
<Unit4>
<Filename Value="..\..\utsTtfUtils.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
<UsageCount Value="62"/>
<UsageCount Value="66"/>
</Unit4>
<Unit5>
<Filename Value="..\..\utsTypes.pas"/>
@@ -58,17 +56,16 @@
<EditorIndex Value="2"/>
<TopLine Value="93"/>
<CursorPos X="5" Y="109"/>
<UsageCount Value="62"/>
<UsageCount Value="66"/>
<Loaded Value="True"/>
</Unit5>
<Unit6>
<Filename Value="..\..\utsUtils.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="utsUtils"/>
<EditorIndex Value="-1"/>
<TopLine Value="174"/>
<CursorPos X="26" Y="194"/>
<UsageCount Value="62"/>
<UsageCount Value="66"/>
</Unit6>
<Unit7>
<Filename Value="..\..\utsFontCreatorGDI.pas"/>
@@ -76,37 +73,36 @@
<UnitName Value="utsFontCreatorGDI"/>
<IsVisibleTab Value="True"/>
<WindowIndex Value="1"/>
<TopLine Value="554"/>
<CursorPos X="11" Y="571"/>
<UsageCount Value="62"/>
<TopLine Value="433"/>
<CursorPos Y="453"/>
<UsageCount Value="66"/>
<Loaded Value="True"/>
</Unit7>
<Unit8>
<Filename Value="..\..\utsCodePages.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="utsCodePages"/>
<EditorIndex Value="-1"/>
<TopLine Value="315"/>
<CursorPos X="21" Y="325"/>
<UsageCount Value="59"/>
<UsageCount Value="63"/>
</Unit8>
<Unit9>
<Filename Value="..\..\utsPostProcess.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="utsPostProcess"/>
<EditorIndex Value="-1"/>
<TopLine Value="216"/>
<CursorPos X="30" Y="227"/>
<UsageCount Value="57"/>
<UsageCount Value="61"/>
</Unit9>
<Unit10>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="utsFontCreatorFreeType"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="1"/>
<TopLine Value="312"/>
<CursorPos X="21" Y="258"/>
<UsageCount Value="46"/>
<TopLine Value="259"/>
<CursorPos X="51" Y="339"/>
<UsageCount Value="50"/>
<Loaded Value="True"/>
</Unit10>
<Unit11>
@@ -117,7 +113,7 @@
<WindowIndex Value="1"/>
<TopLine Value="284"/>
<CursorPos X="12" Y="298"/>
<UsageCount Value="38"/>
<UsageCount Value="42"/>
<Loaded Value="True"/>
</Unit11>
<Unit12>
@@ -126,9 +122,9 @@
<UnitName Value="utsFreeType"/>
<EditorIndex Value="3"/>
<WindowIndex Value="1"/>
<TopLine Value="340"/>
<CursorPos X="26" Y="363"/>
<UsageCount Value="38"/>
<TopLine Value="292"/>
<CursorPos X="31" Y="308"/>
<UsageCount Value="42"/>
<Loaded Value="True"/>
</Unit12>
<Unit13>
@@ -260,7 +256,7 @@
<EditorIndex Value="5"/>
<TopLine Value="113"/>
<CursorPos X="10" Y="129"/>
<UsageCount Value="35"/>
<UsageCount Value="37"/>
<Loaded Value="True"/>
</Unit29>
<Unit30>
@@ -268,7 +264,7 @@
<EditorIndex Value="6"/>
<TopLine Value="2091"/>
<CursorPos X="5" Y="2098"/>
<UsageCount Value="18"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
</Unit30>
<Unit31>
@@ -276,7 +272,7 @@
<EditorIndex Value="7"/>
<TopLine Value="502"/>
<CursorPos X="3" Y="518"/>
<UsageCount Value="33"/>
<UsageCount Value="35"/>
<Loaded Value="True"/>
</Unit31>
<Unit32>
@@ -326,7 +322,7 @@
<EditorIndex Value="8"/>
<TopLine Value="143"/>
<CursorPos X="3" Y="149"/>
<UsageCount Value="27"/>
<UsageCount Value="29"/>
<Loaded Value="True"/>
</Unit38>
<Unit39>
@@ -334,7 +330,7 @@
<EditorIndex Value="9"/>
<TopLine Value="26"/>
<CursorPos X="10" Y="42"/>
<UsageCount Value="25"/>
<UsageCount Value="27"/>
<Loaded Value="True"/>
</Unit39>
<Unit40>
@@ -377,7 +373,7 @@
<Unit45>
<Filename Value="C:\Zusatzprogramme\Lazarus\fpc\2.7.1\source\rtl\inc\objpas.inc"/>
<EditorIndex Value="4"/>
<UsageCount Value="26"/>
<UsageCount Value="28"/>
<Loaded Value="True"/>
</Unit45>
<Unit46>
@@ -442,7 +438,7 @@
<WindowIndex Value="1"/>
<TopLine Value="2705"/>
<CursorPos X="3" Y="2698"/>
<UsageCount Value="15"/>
<UsageCount Value="17"/>
<Loaded Value="True"/>
</Unit53>
<Unit54>
@@ -511,125 +507,131 @@
<EditorIndex Value="10"/>
<TopLine Value="53"/>
<CursorPos X="22" Y="69"/>
<UsageCount Value="23"/>
<UsageCount Value="25"/>
<Loaded Value="True"/>
</Unit63>
</Units>
<JumpHistory Count="26" HistoryIndex="25">
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="..\..\utsTextSuite.pas"/>
<Caret Line="1423" TopLine="1407"/>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="338" TopLine="321"/>
</Position1>
<Position2>
<Filename Value="..\..\utsTextSuite.pas"/>
<Caret Line="1425" TopLine="1407"/>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="339" TopLine="321"/>
</Position2>
<Position3>
<Filename Value="..\..\utsTextSuite.pas"/>
<Caret Line="1429" TopLine="1414"/>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="341" TopLine="321"/>
</Position3>
<Position4>
<Filename Value="..\..\utsTextSuite.pas"/>
<Caret Line="1430" TopLine="1414"/>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="342" TopLine="321"/>
</Position4>
<Position5>
<Filename Value="..\..\utsTextSuite.pas"/>
<Caret Line="1433" TopLine="1414"/>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="343" TopLine="321"/>
</Position5>
<Position6>
<Filename Value="..\..\old\TextSuiteClasses.pas"/>
<Caret Line="1825" Column="21" TopLine="1811"/>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="344" TopLine="321"/>
</Position6>
<Position7>
<Filename Value="..\..\old\TextSuiteClasses.pas"/>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="347" TopLine="321"/>
</Position7>
<Position8>
<Filename Value="..\..\utsTextSuite.pas"/>
<Caret Line="1433" Column="33" TopLine="1423"/>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="348" TopLine="322"/>
</Position8>
<Position9>
<Filename Value="..\..\utsTextSuite.pas"/>
<Caret Line="1515" TopLine="1499"/>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="344" Column="24" TopLine="323"/>
</Position9>
<Position10>
<Filename Value="uMainForm.pas"/>
<Caret Line="87" Column="104" TopLine="73"/>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="338" TopLine="323"/>
</Position10>
<Position11>
<Filename Value="..\..\utsTextSuite.pas"/>
<Caret Line="1517" TopLine="1501"/>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="339" TopLine="323"/>
</Position11>
<Position12>
<Filename Value="uMainForm.pas"/>
<Caret Line="89" Column="57" TopLine="73"/>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="338" TopLine="323"/>
</Position12>
<Position13>
<Filename Value="uMainForm.pas"/>
<Caret Line="87" Column="32" TopLine="73"/>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="339" TopLine="323"/>
</Position13>
<Position14>
<Filename Value="..\..\utsFontCreatorGDI.pas"/>
<Caret Line="571" Column="11" TopLine="554"/>
<Filename Value="..\..\utsFreeType.pas"/>
<Caret Line="45" Column="17" TopLine="30"/>
</Position14>
<Position15>
<Filename Value="uMainForm.pas"/>
<Caret Line="104" Column="3" TopLine="75"/>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="349" Column="30" TopLine="331"/>
</Position15>
<Position16>
<Filename Value="uMainForm.pas"/>
<Caret Line="99" TopLine="75"/>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="351" Column="35" TopLine="331"/>
</Position16>
<Position17>
<Filename Value="uMainForm.pas"/>
<Caret Line="100" TopLine="75"/>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="343" Column="17" TopLine="331"/>
</Position17>
<Position18>
<Filename Value="uMainForm.pas"/>
<Caret Line="101" TopLine="75"/>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="348" TopLine="332"/>
</Position18>
<Position19>
<Filename Value="uMainForm.pas"/>
<Caret Line="102" TopLine="75"/>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="341" Column="28" TopLine="332"/>
</Position19>
<Position20>
<Filename Value="uMainForm.pas"/>
<Caret Line="103" TopLine="76"/>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="348" TopLine="332"/>
</Position20>
<Position21>
<Filename Value="uMainForm.pas"/>
<Caret Line="99" TopLine="76"/>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="349" TopLine="332"/>
</Position21>
<Position22>
<Filename Value="uMainForm.pas"/>
<Caret Line="100" TopLine="76"/>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="341" Column="30" TopLine="332"/>
</Position22>
<Position23>
<Filename Value="uMainForm.pas"/>
<Caret Line="101" TopLine="76"/>
<Filename Value="..\..\utsFontCreatorGDI.pas"/>
<Caret Line="446" TopLine="433"/>
</Position23>
<Position24>
<Filename Value="uMainForm.pas"/>
<Caret Line="102" TopLine="76"/>
<Filename Value="..\..\utsFontCreatorGDI.pas"/>
<Caret Line="447" TopLine="433"/>
</Position24>
<Position25>
<Filename Value="uMainForm.pas"/>
<Caret Line="103" TopLine="76"/>
<Filename Value="..\..\utsFontCreatorGDI.pas"/>
<Caret Line="448" TopLine="433"/>
</Position25>
<Position26>
<Filename Value="uMainForm.pas"/>
<Caret Line="30" Column="5" TopLine="14"/>
<Filename Value="..\..\utsFontCreatorGDI.pas"/>
<Caret Line="449" TopLine="433"/>
</Position26>
<Position27>
<Filename Value="..\..\utsFontCreatorGDI.pas"/>
<Caret Line="446" TopLine="433"/>
</Position27>
<Position28>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="348" TopLine="326"/>
</Position28>
<Position29>
<Filename Value="..\..\utsFontCreatorFreeType.pas"/>
<Caret Line="349" Column="5" TopLine="327"/>
</Position29>
<Position30>
<Filename Value="uMainForm.pas"/>
<Caret Line="90" Column="92" TopLine="60"/>
</Position30>
</JumpHistory>
</ProjectSession>
<Debugging>
<BreakPoints Count="1">
<Item1>
<Kind Value="bpkSource"/>
<WatchScope Value="wpsLocal"/>
<WatchKind Value="wpkWrite"/>
<Source Value="..\..\utsFontCreatorGDI.pas"/>
<Line Value="570"/>
</Item1>
</BreakPoints>
</Debugging>
</CONFIG>

+ 8
- 8
examples/simple/uMainForm.pas Parādīt failu

@@ -50,8 +50,8 @@ uses
dglOpenGL;

const
//TEST_STRING = 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.';
TEST_STRING = 'Lorem';
TEST_STRING = 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.';
//TEST_STRING = 'Lorem';

procedure TMainForm.FormCreate(Sender: TObject);
var
@@ -85,9 +85,9 @@ begin
ftsGenerator.AddPostProcessStep(pp);
}
try
ftsFont1 := ftsGenerator.GetFontByFile('Calibri', ftsRenderer, 25, [tsStyleBold], tsAANormal);
ftsFont2 := ftsGenerator.GetFontByName('Calibri', ftsRenderer, 20, [], tsAANormal);
ftsFont3 := ftsFreeType.GetFontByFile('calibrib.ttf', ftsRenderer, 25, tsAANone);
ftsFont1 := ftsGenerator.GetFontByName('Calibri', ftsRenderer, 25, [tsStyleUnderline], tsAANormal);
ftsFont2 := ftsGenerator.GetFontByName('Calibri', ftsRenderer, 20, [], tsAANormal);
ftsFont3 := ftsFreeType.GetFontByFile('calibri.ttf', ftsRenderer, 25, [tsStyleUnderline], tsAANormal);
except
on e: EtsException do
MessageDlg('Error', e.Message, mtError, [mbOK], 0);
@@ -154,11 +154,11 @@ begin
{$ELSE}
block := ftsRenderer.BeginBlock(0, 0, ClientWidth, ClientHeight, [tsBlockFlagWordWrap]);
try
block.HorzAlign := tsHorzAlignJustify;
//block.HorzAlign := tsHorzAlignJustify;

block.ChangeFont(ftsFont1);
block.ChangeColor(tsColor4f(1.0, 1.0, 1.0, 1.0));
block.TextOutW(TEST_STRING + sLineBreak);
block.ChangeColor(tsColor4f(1.0, 0.0, 0.0, 1.0));
block.TextOutA(TEST_STRING + sLineBreak);

block.ChangeFont(ftsFont3);
block.ChangeColor(tsColor4f(1.0, 1.0, 1.0, 1.0));


+ 23
- 12
utsFontCreatorFreeType.pas Parādīt failu

@@ -41,8 +41,8 @@ type
procedure GetCharImage(const aFont: TtsFont; const aCharCode: WideChar;
const aCharImage: TtsImage); override;
public
function GetFontByFile(const aFilename: String; const aRenderer: TtsRenderer;
const aSize: Integer; const aAntiAliasing: TtsAntiAliasing): TtsFont; overload;
function GetFontByFile(const aFilename: String; const aRenderer: TtsRenderer; const aSize: Integer;
const aStyle: TtsFontStyles; const aAntiAliasing: TtsAntiAliasing): TtsFont; overload;

constructor Create(const aContext: TtsContext);
destructor Destroy; override;
@@ -299,11 +299,13 @@ end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function TtsFontGeneratorFreeType.GetFontByFile(const aFilename: String; const aRenderer: TtsRenderer;
const aSize: Integer; const aAntiAliasing: TtsAntiAliasing): TtsFont;
const aSize: Integer; const aStyle: TtsFontStyles; const aAntiAliasing: TtsAntiAliasing): TtsFont;
var
face: FT_Face;
err: FT_Error;
prop: TtsFontProperties;
os2: PTT_OS2;
hz: PTT_HoriHeader;
begin
err := FT_New_Face(fHandle, PAnsiChar(aFilename), 0, @face);
if (err <> 0) then
@@ -322,21 +324,30 @@ begin
prop.Size := aSize;
prop.AntiAliasing := aAntiAliasing;
prop.DefaultChar := '?';
prop.Style := [];
if ((face^.style_flags and FT_STYLE_FLAG_BOLD) <> 0) then
Include(prop.Style, tsStyleBold);
if ((face^.style_flags and FT_STYLE_FLAG_ITALIC) <> 0) then
Include(prop.Style, tsStyleItalic);
prop.Style := aStyle + [tsStyleBold, tsStyleItalic];
if ((face^.style_flags and FT_STYLE_FLAG_BOLD) = 0) then
Exclude(prop.Style, tsStyleBold);
if ((face^.style_flags and FT_STYLE_FLAG_ITALIC) = 0) then
Exclude(prop.Style, tsStyleItalic);

prop.Ascent := face^.size^.metrics.ascender div FT_SIZE_FACTOR;
prop.Descent := -face^.size^.metrics.descender div FT_SIZE_FACTOR;
prop.ExternalLeading := 0;
prop.BaseLineOffset := 0;

prop.UnderlinePos := face^.underline_position div FT_SIZE_FACTOR;
prop.UnderlineSize := face^.underline_thickness div FT_SIZE_FACTOR;
prop.StrikeoutPos := 0;
prop.StrikeoutSize := 0;
prop.UnderlinePos := face^.underline_position div FT_SIZE_FACTOR;
prop.UnderlineSize := face^.underline_thickness div FT_SIZE_FACTOR;

os2 := PTT_OS2(FT_Get_Sfnt_Table(face, FT_SFNT_OS2));
if Assigned(os2) and (os2^.version <> $FFFF) then begin
prop.StrikeoutPos := os2^.yStrikeoutPosition div FT_SIZE_FACTOR;
prop.StrikeoutSize := os2^.yStrikeoutSize div FT_SIZE_FACTOR;
end;

hz := PTT_HoriHeader(FT_Get_Sfnt_Table(face, FT_SFNT_HHEA));
if Assigned(hz) then begin
prop.ExternalLeading := hz^.Line_Gap div FT_SIZE_FACTOR;
end;

result := TtsFontFreeType.Create(TtsFreeTypeFaceHandle.Create(face), aRenderer, self, prop);
end;


+ 116
- 12
utsFreeType.pas Parādīt failu

@@ -11,7 +11,9 @@ type
// Simple Types
FT_Error = Integer;
FT_Library = Pointer;
FT_Short = ShortInt;
FT_Short = SmallInt;
FT_Byte = Byte;
FT_Char = AnsiChar;
FT_UShort = Word;
FT_Int = Integer;
FT_Int32 = Integer;
@@ -33,11 +35,14 @@ type
FT_Size = ^FT_SizeRec;
FT_CharMap = ^FT_CharMapRec;

PFT_Library = ^FT_Library;
PFT_Face = ^FT_Face;
PFT_String = ^FT_String;
PFT_SfntName = ^FT_SfntName;
PFT_Bitmap = ^FT_Bitmap;
PFT_Library = ^FT_Library;
PFT_Face = ^FT_Face;
PFT_String = ^FT_String;
PFT_SfntName = ^FT_SfntName;
PFT_Bitmap = ^FT_Bitmap;
PTT_OS2 = ^TT_OS2;
PTT_Postscript = ^TT_Postscript;
PTT_HoriHeader = ^TT_HoriHeader;

// unneeded
FT_Driver = Pointer;
@@ -233,6 +238,94 @@ type
string_len: FT_UInt;
end;

TT_OS2 = record
version: FT_UShort;
xAvgCharWidth: FT_Short;
usWeightClass: FT_UShort;
usWidthClass: FT_UShort;
fsType: FT_Short;

ySubscriptXSize: FT_Short;
ySubscriptYSize: FT_Short;
ySubscriptXOffset: FT_Short;
ySubscriptYOffset: FT_Short;
ySuperscriptXSize: FT_Short;
ySuperscriptYSize: FT_Short;
ySuperscriptXOffset: FT_Short;
ySuperscriptYOffset: FT_Short;
yStrikeoutSize: FT_Short;
yStrikeoutPosition: FT_Short;
sFamilyClass: FT_Short;

panose: array[0..9] of FT_Byte;

ulUnicodeRange1: FT_ULong;
ulUnicodeRange3: FT_ULong;
ulUnicodeRange2: FT_ULong;
ulUnicodeRange4: FT_ULong;

achVendID: array[0..3] of FT_Char;

fsSelection: FT_UShort;
usFirstCharIndex: FT_UShort;
usLastCharIndex: FT_UShort;
sTypoAscender: FT_Short;
sTypoDescender: FT_Short;
sTypoLineGap: FT_Short;
usWinAscent: FT_UShort;
usWinDescent: FT_UShort;

ulCodePageRange1: FT_ULong;
ulCodePageRange2: FT_ULong;

{ only version 2 and higher: }
sxHeight: FT_Short;
sCapHeight: FT_Short;
usDefaultChar: FT_UShort;
usBreakChar: FT_UShort;
usMaxContext: FT_UShort;

{ only version 5 and higher: }
usLowerOpticalPointSize: FT_UShort;
usUpperOpticalPointSize: FT_UShort;
end;

TT_Postscript = record
FormatType: FT_Fixed;
italicAngle: FT_Fixed;
underlinePosition: FT_Short;
underlineThickness: FT_Short;
isFixedPitch: FT_ULong;
minMemType42: FT_ULong;
maxMemType42: FT_ULong;
minMemType1: FT_ULong;
maxMemType1: FT_ULong;
end;

TT_HoriHeader = record
Version: FT_Fixed;
Ascender: FT_Short;
Descender: FT_Short;
Line_Gap: FT_Short;

advance_Width_Max: FT_UShort;

min_Left_Side_Bearin: FT_Short;
min_Right_Side_Bearing: FT_Short;
xMax_Extent: FT_Short;
caret_Slope_Rise: FT_Short;
caret_Slope_Run: FT_Short;
caret_Offset: FT_Short;

Reserved: array[0..3] of FT_Short;

metric_Data_Format: FT_Short;
number_Of_HMetrics: FT_UShort;

long_metrics: Pointer;
short_metrics: Pointer;
end;

TFT_Init_FreeType = function(aLibrary: PFT_Library): FT_Error;
TFT_Done_FreeType = function(aLibrary: FT_Library): FT_Error;
TFT_New_Face = function(aLibrary: FT_Library; const aFilename: PAnsiChar; aFaceIndex: FT_Long; aFace: PFT_Face): FT_Error;
@@ -241,8 +334,9 @@ type
TFT_Get_Sfnt_Name_Count = function(aFace: FT_Face): FT_UInt;
TFT_Get_Sfnt_Name = function(aFace: FT_Face; aIndex: FT_UInt; aName: PFT_SfntName): FT_Error;

TFT_Set_Char_Size = function(aFace: FT_Face; aCharWidth: FT_F26Dot6; aCharHeight: FT_F26Dot6; aHorzDPI: FT_UInt; aVertDPI: FT_UInt): FT_Error;
TFT_Load_Char = function(aFace: FT_Face; aCharCode: FT_ULong; aLoadFlags: FT_Int32): FT_Error;
TFT_Set_Char_Size = function(aFace: FT_Face; aCharWidth: FT_F26Dot6; aCharHeight: FT_F26Dot6; aHorzDPI: FT_UInt; aVertDPI: FT_UInt): FT_Error;
TFT_Load_Char = function(aFace: FT_Face; aCharCode: FT_ULong; aLoadFlags: FT_Int32): FT_Error;
TFT_Get_Sfnt_Table = function(aFace: FT_Face; aTag: Integer): Pointer;

var
FT_Init_FreeType: TFT_Init_FreeType;
@@ -253,8 +347,9 @@ var
FT_Get_Sfnt_Name_Count: TFT_Get_Sfnt_Name_Count;
FT_Get_Sfnt_Name: TFT_Get_Sfnt_Name;

FT_Set_Char_Size: TFT_Set_Char_Size;
FT_Load_Char: TFT_Load_Char;
FT_Set_Char_Size: TFT_Set_Char_Size;
FT_Load_Char: TFT_Load_Char;
FT_Get_Sfnt_Table: TFT_Get_Sfnt_Table;

const
TT_NAME_ID_COPYRIGHT = 0;
@@ -486,6 +581,14 @@ const
FT_LOAD_TARGET_LCD = FT_RENDER_MODE_LCD shl 16;
FT_LOAD_TARGET_LCD_V = FT_RENDER_MODE_LCD_V shl 16;

FT_SFNT_HEAD = 0;
FT_SFNT_MAXP = 1;
FT_SFNT_OS2 = 2;
FT_SFNT_HHEA = 3;
FT_SFNT_VHEA = 4;
FT_SFNT_POST = 5;
FT_SFNT_PCLT = 6;

function InitFreeType: FT_Library;
procedure QuitFreeType;

@@ -553,8 +656,9 @@ begin
FT_Get_Sfnt_Name_Count := TFT_Get_Sfnt_Name_Count(GetProcAddr('FT_Get_Sfnt_Name_Count'));
FT_Get_Sfnt_Name := TFT_Get_Sfnt_Name( GetProcAddr('FT_Get_Sfnt_Name'));

FT_Set_Char_Size := TFT_Set_Char_Size(GetProcAddr('FT_Set_Char_Size'));
FT_Load_Char := TFT_Load_Char( GetProcAddr('FT_Load_Char'));
FT_Set_Char_Size := TFT_Set_Char_Size( GetProcAddr('FT_Set_Char_Size'));
FT_Load_Char := TFT_Load_Char( GetProcAddr('FT_Load_Char'));
FT_Get_Sfnt_Table := TFT_Get_Sfnt_Table(GetProcAddr('FT_Get_Sfnt_Table'));

err := FT_Init_FreeType(@ftLibrary);
if (err <> 0) then


+ 1
- 1
utsTextSuite.pas Parādīt failu

@@ -1446,8 +1446,8 @@ begin
// move glyph rect
aChar.GlyphRect := tsRect(
aChar.GlyphRect.Left + NewPos.x,
aChar.GlyphRect.Right + NewPos.x,
aChar.GlyphRect.Top + NewPos.y,
aChar.GlyphRect.Right + NewPos.x,
aChar.GlyphRect.Bottom + NewPos.y);
end;



Notiek ielāde…
Atcelt
Saglabāt