[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft-devel] How to map a char to glyph with pcf
From: |
duhuanpeng |
Subject: |
Re: [ft-devel] How to map a char to glyph with pcf |
Date: |
Thu, 22 Mar 2018 22:14:21 +0800 |
Hi, my Korean text is encoded in ecu format in a array like:
const char textkr[] =
"\xb4\xeb\xc7\xd1\xb9\xce\xb1\xb9\x20\xc1\xa4\xba\xce\xb8\xa6\x20"
"\xc7\xd1\x20\xb9\xf8\xbf\xa1\x20\xb8\xb8\xb3\xaa\xb4\xc2\x20\xc5"
"\xeb\xc7\xd5\xc3\xa2\xb1\xb8";
Now I have make three trick to map "EUC encoded char" to "Glyph Index" in the
pcf:
[link 1] https://paste.ubuntu.com/p/dT7Yg3kYZt/
my code is based on thie document:
[link 2] https://www.itscj.ipsj.or.jp/iso-ir/149.pdf
I was sorry I didn't explain my problem clearly. I want to know if freetype2
have
Done this mapping(step [3]) in the library? Or I have to write extra code for
support it?[link 1]
[1] char buf[2]="\xb4\xeb";
[2] buf &= 0x7F; buf -= 0x20;
[3] buf --> Glyph Index
duhuanpeng
>Yes, of course – IIRC I've mentioned already in a previous e-mail that you
>need `iconv'...
Do you mean translate "Unicode" --> "EUC" like :
$ ls /usr/share/fonts/X11/encodings/
Thanks for this information.
You have to use function `FT_Get_BDF_Property' to extract the
`CHARSET_REGISTRY' and `CHARSET_ENCODING' fields from your PCF font.
Using this information you can set up, say, function `iconv' to map from
Unicode to the font's cmap.
Using
FT2_DEBUG=any:7 ftdump gothic14.pcf.Z
I see
CHARSET_REGISTRY: `KSC5601.1987'
CHARSET_ENCODING: `0'
in the debug messages. The characters in the font are indeed encoded as plain
KSC5601. A standard `iconv' call doesn't support this out of the box, I think;
you have to convert this to the EUC-KR form by adding 0x8080 to each code point
(e.g. 0x2121 -> 0xA1A1).[1]
This reminds me of good, old ISO-2022, with Emacs as the only editor that
really supports it :-)
Werner
[1] https://en.wikipedia.org/wiki/Extended_Unix_Code
Message not available