Page 1 of 1

polish and german diacritics

Posted: December 1st, 2006, 12:53 pm
by rednaskellar
Hello,

I modified a little demo.dll plugin so it can display polish or german national characters.
Syntax is just like for other plugins, function 1 is for polish and 2 is for german language, plugin uses only 1 parameter, ie:

$dll(pl_de.dll,1,ąćę?łń?śż,param2)

dislplays polish diacritics.

Here's the code:

Code: Select all


Function function1(param1:pchar;param2:pchar):pchar; stdcall;
// polish/polski
var
  regel:String;
begin
  try
    regel:=param1;
    regel:=StringReplace(regel,'ą','$CustomChar(1,0,0,14,1,15,17,14,3)$Chr(176)',[rfReplaceAll]);
    regel:=StringReplace(regel,'ć','$CustomChar(2,2,4,14,16,16,17,14,0)$Chr(158)',[rfReplaceAll]);
    regel:=StringReplace(regel,'ę','$CustomChar(3,0,0,14,17,31,16,14,3)$Chr(131)',[rfReplaceAll]);
    regel:=StringReplace(regel,'ł','$CustomChar(4,12,4,6,12,4,4,14,0)$Chr(132)',[rfReplaceAll]);
    regel:=StringReplace(regel,'ń','$CustomChar(5,2,4,22,25,17,17,17,0)$Chr(133)',[rfReplaceAll]);
    regel:=StringReplace(regel,'?','$CustomChar(6,2,4,14,17,17,17,14,0)$Chr(134)',[rfReplaceAll]);
    regel:=StringReplace(regel,'ś','$CustomChar(7,2,4,14,16,14,1,30,0)$Chr(135)',[rfReplaceAll]);
    regel:=StringReplace(regel,'ż','$CustomChar(8,4,0,31,2,4,8,31,0)$Chr(136)',[rfReplaceAll]);
    regel:=StringReplace(regel,'ź','$CustomChar(8,4,0,31,2,4,8,31,0)$Chr(136)',[rfReplaceAll]);
    regel:=StringReplace(regel,'Ą','$CustomChar(1,0,0,14,1,15,17,14,3)$Chr(176)',[rfReplaceAll]);
    regel:=StringReplace(regel,'Ć','$CustomChar(2,2,4,14,16,16,17,14,0)$Chr(158)',[rfReplaceAll]);
    regel:=StringReplace(regel,'Ę','$CustomChar(3,0,0,14,17,31,16,14,3)$Chr(131)',[rfReplaceAll]);
    regel:=StringReplace(regel,'Ł','$CustomChar(4,12,4,6,12,4,4,14,0)$Chr(132)',[rfReplaceAll]);
    regel:=StringReplace(regel,'Ń','$CustomChar(5,2,4,22,25,17,17,17,0)$Chr(133)',[rfReplaceAll]);
    regel:=StringReplace(regel,'?','$CustomChar(6,2,4,14,17,17,17,14,0)$Chr(134)',[rfReplaceAll]);
    regel:=StringReplace(regel,'Ś','$CustomChar(7,2,4,14,16,14,1,30,0)$Chr(135)',[rfReplaceAll]);
    regel:=StringReplace(regel,'Ż','$CustomChar(8,4,0,31,2,4,8,31,0)$Chr(136)',[rfReplaceAll]);
    regel:=StringReplace(regel,'Ź','$CustomChar(8,4,0,31,2,4,8,31,0)$Chr(136)',[rfReplaceAll]);
    result:=pchar(regel);

  except
    on E: Exception do
      result := PChar('plugin had exception: ' + E.Message);
  end;
end;

Function function2(param1:pchar;param2:pchar):pchar; stdcall;
// german/deutsch
var
  regel:String;
begin
  try
    regel:=param1;
    regel:=StringReplace(regel,'?','$CustomChar(1,10,0,14,1,15,17,15,0)$Chr(176)',[rfReplaceAll]);
    regel:=StringReplace(regel,'?','$CustomChar(2,10,0,14,17,17,17,14,0)$Chr(158)',[rfReplaceAll]);
    regel:=StringReplace(regel,'?','$CustomChar(3,12,18,20,18,17,17,30,16)$Chr(131)',[rfReplaceAll]);
    regel:=StringReplace(regel,'?','$CustomChar(4,10,0,17,17,17,19,13,0)$Chr(132)',[rfReplaceAll]);
    regel:=StringReplace(regel,'?','$CustomChar(5,10,0,14,17,17,31,17,0)$Chr(133)',[rfReplaceAll]);
    regel:=StringReplace(regel,'?','$CustomChar(2,10,0,14,17,17,17,14,0)$Chr(158)',[rfReplaceAll]);
    regel:=StringReplace(regel,'?','$CustomChar(4,10,0,17,17,17,19,13,0)$Chr(132)',[rfReplaceAll]);
    result:=pchar(regel);
  except
    on E: Exception do
      result := PChar('plugin had exception: ' + E.Message);
  end;
end;
It is not so complicated ;) But it works good.
Since one can use only 8 custom characters, letter ź which occurs not often is changed to ż, and all capital letters are changed to small letters, ie Ą - ą, Ć - ć.

Hope someone found this usefull.

rednaskellar

Posted: December 1st, 2006, 7:53 pm
by mattcro
Many LCDs will already have some of these characters in their internal font ROM, for example "a", "o" and "u" umlaut (at least in lower case) and beta (German "ss").

My LCD has an English/Japanese character set, but also has a few European characters. There is a different Euro character set too. You may be able to save a few custom characters by using internal characters like this.

Posted: December 2nd, 2006, 9:44 am
by rednaskellar

My LCD has an English/Japanese character set, but also has a few European characters. There is a different Euro character set too. You may be able to save a few custom characters by using internal characters like this.
you're right. my lcd has also eng/jap set, and umlauts but not single one polish letter. So I could only save place by german letters, not polish. Btw this plugin can be easy modified and I do not need some extra characters when polish or german is displayed.