summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2015-02-28 17:49:08 +0000
committerGraeme Geldenhuys <graemeg@gmail.com>2015-02-28 17:49:08 +0000
commit7a273fb571e35eb8edc3ca6e5d54d070db962012 (patch)
tree0c025f9ff4087743980d6eb8d4a234badb9e1cc6
parentfa5b0fac1f187cc3fd6c1f342e9575b3b744f2c6 (diff)
downloadfpGUI-7a273fb571e35eb8edc3ca6e5d54d070db962012.tar.xz
bug: Fixes GDI issue where if font name contain a @ or - symbol the couldn't be selected
For example: '@Terminal-10' did not work. Neither did 'VNI-Bamas-10'. The tokenizer was improved to look-ahead or accept extra characters like the @ symbol.
-rw-r--r--src/corelib/gdi/fpg_gdi.pas20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/corelib/gdi/fpg_gdi.pas b/src/corelib/gdi/fpg_gdi.pas
index b24b04be..a1d314f6 100644
--- a/src/corelib/gdi/fpg_gdi.pas
+++ b/src/corelib/gdi/fpg_gdi.pas
@@ -2621,13 +2621,31 @@ var
Result := c;
end;
+ function LookAhead: char;
+ var
+ i: integer;
+ lc: char;
+ begin
+ i := cp+1;
+ if i > length(desc) then
+ lc := #0
+ else
+ lc := desc[i];
+ result := lc;
+ end;
+
procedure NextToken;
begin
token := '';
- while (c <> #0) and (c in [' ', 'a'..'z', 'A'..'Z', '_', '0'..'9']) do
+ while (c <> #0) and (c in [' ', 'a'..'z', 'A'..'Z', '_', '@', '0'..'9']) do
begin
token := token + c;
NextC;
+ if (c = '-') and (LookAhead in [' ', 'a'..'z', 'A'..'Z', '_']) then
+ begin
+ token := token + c;
+ NextC;
+ end;
end;
end;