mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-25 23:43:17 +02:00
LCL, PostcriptUnicode: fill tables on demand
git-svn-id: trunk@27350 -
This commit is contained in:
parent
d897a56d00
commit
64a78a2f30
@ -34,6 +34,7 @@ type
|
|||||||
Name: string[21];
|
Name: string[21];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// TODO: modify GlyphsArr sorted by Name
|
||||||
{$i glyphlist.inc}
|
{$i glyphlist.inc}
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -50,9 +51,9 @@ type
|
|||||||
FOutLst, FBaseFonts,FEncodedFonts,FUsedFonts: TStringList;
|
FOutLst, FBaseFonts,FEncodedFonts,FUsedFonts: TStringList;
|
||||||
FLastFontIndex: Integer;
|
FLastFontIndex: Integer;
|
||||||
FFont: string;
|
FFont: string;
|
||||||
|
procedure CountPSChars;
|
||||||
procedure CreateGlyphMap;
|
procedure CreateGlyphMap;
|
||||||
procedure CreateUniCodeBlocks;
|
procedure CreateUniCodeBlocks;
|
||||||
procedure CountPSChars;
|
|
||||||
function FindEncodingIndex(ABlock: Integer): Integer;
|
function FindEncodingIndex(ABlock: Integer): Integer;
|
||||||
function IndexOfFont(AFontName:string; AFontSize,AFontStyle,ABlock:Integer): Integer;
|
function IndexOfFont(AFontName:string; AFontSize,AFontStyle,ABlock:Integer): Integer;
|
||||||
function SelectFont(AFontName:string; AFontSize,AFontStyle,ABlock:Integer): string;
|
function SelectFont(AFontName:string; AFontSize,AFontStyle,ABlock:Integer): string;
|
||||||
@ -89,9 +90,15 @@ procedure TPsUnicode.CreateGlyphMap;
|
|||||||
var
|
var
|
||||||
i: word;
|
i: word;
|
||||||
begin
|
begin
|
||||||
|
|
||||||
|
if FGlyphs<>nil then
|
||||||
|
exit;
|
||||||
|
|
||||||
FGlyphs := TMap.Create(itu2, SizeOf(word));
|
FGlyphs := TMap.Create(itu2, SizeOf(word));
|
||||||
for i:=0 to GLYPHCOUNT-1 do
|
for i:=0 to GLYPHCOUNT-1 do
|
||||||
FGlyphs.Add(GlyphsArr[i].Code, i);
|
FGlyphs.Add(GlyphsArr[i].Code, i);
|
||||||
|
|
||||||
|
CountPSChars;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPsUnicode.CreateUniCodeBlocks;
|
procedure TPsUnicode.CreateUniCodeBlocks;
|
||||||
@ -105,6 +112,8 @@ procedure TPsUnicode.CreateUniCodeBlocks;
|
|||||||
FBlocks[i].Fin:=Fin;
|
FBlocks[i].Fin:=Fin;
|
||||||
end;
|
end;
|
||||||
begin
|
begin
|
||||||
|
if Length(FBlocks)>0 then
|
||||||
|
exit;
|
||||||
//(^([A-Z0-9 \-]+)*).U\+([A-F0-9]+).U\+([A-F0-9]+)
|
//(^([A-Z0-9 \-]+)*).U\+([A-F0-9]+).U\+([A-F0-9]+)
|
||||||
// AddBlock\(\$$3,\$$4); // $1
|
// AddBlock\(\$$3,\$$4); // $1
|
||||||
|
|
||||||
@ -289,9 +298,6 @@ end;
|
|||||||
constructor TPsUnicode.create;
|
constructor TPsUnicode.create;
|
||||||
begin
|
begin
|
||||||
inherited create;
|
inherited create;
|
||||||
CreateUnicodeBlocks;
|
|
||||||
CreateGlyphMap;
|
|
||||||
CountPSChars;
|
|
||||||
FBaseFonts := TStringList.Create;
|
FBaseFonts := TStringList.Create;
|
||||||
FEncodedFonts := TStringList.Create;
|
FEncodedFonts := TStringList.Create;
|
||||||
FUsedFonts := TStringList.Create;
|
FUsedFonts := TStringList.Create;
|
||||||
@ -331,6 +337,10 @@ var
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
|
||||||
|
CreateUnicodeBlocks;
|
||||||
|
CreateGlyphMap;
|
||||||
|
|
||||||
UStr := UTF8Decode(S);
|
UStr := UTF8Decode(S);
|
||||||
SubStr := '';
|
SubStr := '';
|
||||||
for i:=1 to Length(UStr) do begin
|
for i:=1 to Length(UStr) do begin
|
||||||
@ -373,6 +383,7 @@ function TPsUnicode.BlockFor(var w: word): integer;
|
|||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
|
CreateUnicodeBlocks;
|
||||||
for i:=0 to Length(FBlocks)-1 do begin
|
for i:=0 to Length(FBlocks)-1 do begin
|
||||||
if FBlocks[i].PSCount=0 then
|
if FBlocks[i].PSCount=0 then
|
||||||
continue;
|
continue;
|
||||||
@ -479,6 +490,7 @@ var
|
|||||||
S: string;
|
S: string;
|
||||||
n: Integer;
|
n: Integer;
|
||||||
begin
|
begin
|
||||||
|
CreateGlyphMap;
|
||||||
n := FBlocks[i].Fin-FBlocks[i].Ini+1;
|
n := FBlocks[i].Fin-FBlocks[i].Ini+1;
|
||||||
g := FBlocks[i].Ini;
|
g := FBlocks[i].Ini;
|
||||||
S := '';
|
S := '';
|
||||||
@ -533,6 +545,8 @@ function TPsUnicode.UnicodeToGlyph(w: word): string;
|
|||||||
var
|
var
|
||||||
i: word;
|
i: word;
|
||||||
begin
|
begin
|
||||||
|
CreateGlyphMap;
|
||||||
|
|
||||||
if FGlyphs.GetData(w, i) then
|
if FGlyphs.GetData(w, i) then
|
||||||
result := GlyphsArr[i].Name
|
result := GlyphsArr[i].Name
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user