Is there a tool like txt2dat but allows unicode characters?
txt2dat for unicode
RE: txt2dat for unicode
2020-05-08, 9:56 (This post was last modified: 2020-05-08, 9:57 by Philippe Hurbain.)
2020-05-08, 9:56 (This post was last modified: 2020-05-08, 9:57 by Philippe Hurbain.)
(2020-05-07, 23:39)Orion Pobursky Wrote: Is there a tool like txt2dat but allows unicode characters?None I know of... I use the character code I want to add with -a option:
eg. to get the ®
Code:
txt2dat -s "LEGO" -a 174 -s " House" -o house.dat -l -p 50 -h 80 -c 15 -b 0 Arial.ttf
![Wink Wink](https://forums.ldraw.org/images/smilies/wink.png)
(2020-05-08, 9:56)Philippe Hurbain Wrote: None I know of... I use the character code I want to add with -a option:
eg. to get the ®
After that... need to shrink to get superscript, but that's another storyCode:txt2dat -s "LEGO" -a 174 -s " House" -o house.dat -l -p 50 -h 80 -c 15 -b 0 Arial.ttf
Note that in theory you can get a lot of characters generated this way by changing your Windows Code Page. I don't know off-hand how to do that, or if simply setting an environment variable can localize it to the command window where you're running txt2dat.
Side note: txt2dat appears to be gone from the internet.
(2020-05-09, 3:36)Travis Cobbs Wrote: Note that in theory you can get a lot of characters generated this way by changing your Windows Code Page. I don't know off-hand how to do that, or if simply setting an environment variable can localize it to the command window where you're running txt2dat.
You could use a font editor to get the needed characters in the 65-90 range in a modified custom font file.
my 2cts
(2020-05-09, 23:12)Orion Pobursky Wrote: There's no ascii code. It's U-201C
Font files have a character table, so with an editor (maybe fontforge ?) you can move whatever is at U-201C to e.g. 65.
Then use the modified (saved as) font file with txt2dat to let it render 'A' which is actually the U-201C character.
(2020-05-09, 23:16)Roland Melkert Wrote: maybe fontforge ?
It's very easy in font forge:
https://fontforge.org/en-US/
Just copy the glyph at 0x201c and paste it in an ascii character slot (e.g. the normal " one) so non unicode programs can use it anyway.
(2020-05-09, 23:36)Roland Melkert Wrote: It's very easy in font forge:
https://fontforge.org/en-US/
Just copy the glyph at 0x201c and paste it in an ascii character slot (e.g. the normal " one) so non unicode programs can use it anyway.
Oh. Ok. Cool. Thanks ?
(2020-05-09, 23:12)Orion Pobursky Wrote: There's no ascii code. It's U-201C
That's character 147 in the default Windows code page in America (CP 1252, Windows Latin 1):
https://en.wikipedia.org/wiki/Windows-1252
So, -a 147 should produce that character without requiring any font editing.
(2020-05-09, 23:12)Orion Pobursky Wrote: There's no ascii code. It's U-201CNote that I didn't talk of ASCII code... I explore the character table of the font I want to use till I find the glyph I need, and add the (decimal) code to txt2dat command line:
Code:
txt2dat -a 7682 -a 65210 -a 946 -a 1488 -a 9567 -o characters.dat -l -p 50 -h 120 -c 15 -b 0 Arial.ttf
![PNG Image .png](https://forums.ldraw.org/images/attachtypes/image.png)
Gives this
(2020-05-10, 7:11)Philippe Hurbain Wrote: Note that I didn't talk of ASCII code... I explore the character table of the font I want to use till I find the glyph I need, and add the (decimal) code to txt2dat command line:Thanks for spelling it out for my dense brain. I thought I knew this stuff but I guess the answer to that is no.
Code:txt2dat -a 7682 -a 65210 -a 946 -a 1488 -a 9567 -o characters.dat -l -p 50 -h 120 -c 15 -b 0 Arial.ttf
Gives this
(2020-05-10, 17:36)Orion Pobursky Wrote: Thanks for spelling it out for my dense brain. I thought I knew this stuff but I guess the answer to that is no.
![PNG Image .png](https://forums.ldraw.org/images/attachtypes/image.png)
And it worked. Thanks again.
(2020-05-10, 7:11)Philippe Hurbain Wrote: Note that I didn't talk of ASCII code... I explore the character table of the font I want to use till I find the glyph I need, and add the (decimal) code to txt2dat command line:
Code:txt2dat -a 7682 -a 65210 -a 946 -a 1488 -a 9567 -o characters.dat -l -p 50 -h 120 -c 15 -b 0 Arial.ttf
Gives this
That means that my suggestion wouldn't have worked, since -a is clearly not using the code page. It also means that somebody could write a Unicode-aware app that produces txt2dat command lines using -a, since the value after the -a appears to just be the Unicode value converted from hexadecimal to decimal.
« Next Oldest | Next Newest »
Users browsing this thread: 2 Guest(s)