Merged revision(s) 61291 #5b5ad75799 from trunk:

LazUtils: Add OnCompare func for TFreeTypeFont's AVLTree. Prevents adding glyphs many times. Issue .
........

git-svn-id: branches/fixes_2_0@62837 -
This commit is contained in:
maxim 2020-03-31 21:24:23 +00:00
parent c30586b3f9
commit b110179beb
4 changed files with 20 additions and 7 deletions

View File

@ -486,6 +486,19 @@ begin
raise Exception.Create('FreeType cannot be initialized');
end;
function GlyphTableOnCompare(Item1, Item2: Pointer): Integer;
var
G1: TFreeTypeGlyph absolute Item1;
G2: TFreeTypeGlyph absolute Item2;
begin
if G1.Index > G2.Index then
Result := 1
else if G1.Index < G2.Index then
Result := -1
else
Result := 0;
end;
{ TFreeTypeRenderableFont }
procedure TFreeTypeRenderableFont.DefaultWordBreakHandler(var ABefore,
@ -1436,6 +1449,7 @@ begin
FPointSize := 10;
FDPI := 96;
FGlyphTable := TAvlTree.Create;
FGlyphTable.OnCompare := @GlyphTableOnCompare;
FHinted := true;
FWidthFactor := 1;
FClearType := false;

View File

@ -1,10 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<Version Value="12"/>
<General>
<Flags>
<CompatibilityMode Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="lazfreetypetest"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
@ -47,8 +49,6 @@
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>

View File

@ -14,7 +14,7 @@ object Form1: TForm1
OnPaint = FormPaint
OnShow = FormShow
Position = poDefault
LCLVersion = '1.9.0.0'
LCLVersion = '2.1.0.0'
object Panel_Option: TPanel
Left = 0
Height = 40

View File

@ -139,8 +139,7 @@ begin
lazimg.Free;
end;
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
begin
mx := X;
my := Y;