Font for use with Hangul Jamo.
Font for use with Hangul Jamo.
I am using ImageMagick in conjunction with this script:
https://github.com/sepoto/powershell_font_to_texturemap
The script works very well as long as the font is carefully chosen. For Hangul Jamo:
0x1100 - 0x11FF
I have not yet been able to find a font that will output this range. I have tried so far a lot of choices from the noto font kit, Code2000, Batang, Malgun-Gothic. In every case I am getting a '?' character. In some cases I get a Hangul Jamo character and a '?' to come out together in the same image. Is there some choice of font for Hangul Jamo that is known I can use in conjunction with ImageMagick?
Thank you...
https://github.com/sepoto/powershell_font_to_texturemap
The script works very well as long as the font is carefully chosen. For Hangul Jamo:
0x1100 - 0x11FF
I have not yet been able to find a font that will output this range. I have tried so far a lot of choices from the noto font kit, Code2000, Batang, Malgun-Gothic. In every case I am getting a '?' character. In some cases I get a Hangul Jamo character and a '?' to come out together in the same image. Is there some choice of font for Hangul Jamo that is known I can use in conjunction with ImageMagick?
Thank you...
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Font for use with Hangul Jamo.
try typing your font in a UTF8 compatible text file, then use the command line with label:@file and see if that works. Then if so, check your other script. (Start with the simplest command to see if the font works)
Re: Font for use with Hangul Jamo.
Then I must post a completely non script example to display that there is a problem occurring outside of the script:
This is my text file mychar.txt as with a Hangul Jamo character inside (Screenshot:)
http://imagebin.ca/v/28QRdnQcl1yA
This is the command that is used:
C:\Users\erics_000\Documents\GitHub\powershell_font_to_texturemap>C:\ImageMagick\convert.exe -background transparent -fill hsb(0,0,0) -font Batang -density 90 -
pointsize 18 -gravity center label:@mychar.txt C:\Users\erics_000\Desktop\Output\Chars\1110.png
The output comes out looking like this:
http://imagebin.ca/v/28QSOJhNn3du
I've manually removed an extra carriage return and trimmed all leading and trailing spaces from my Hangul Jamo character in my text file. Still the output comes out with a '?' in the image. Is it known why this may be occuring?
Thank you...
This is my text file mychar.txt as with a Hangul Jamo character inside (Screenshot:)
http://imagebin.ca/v/28QRdnQcl1yA
This is the command that is used:
C:\Users\erics_000\Documents\GitHub\powershell_font_to_texturemap>C:\ImageMagick\convert.exe -background transparent -fill hsb(0,0,0) -font Batang -density 90 -
pointsize 18 -gravity center label:@mychar.txt C:\Users\erics_000\Desktop\Output\Chars\1110.png
The output comes out looking like this:
http://imagebin.ca/v/28QSOJhNn3du
I've manually removed an extra carriage return and trimmed all leading and trailing spaces from my Hangul Jamo character in my text file. Still the output comes out with a '?' in the image. Is it known why this may be occuring?
Thank you...
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Font for use with Hangul Jamo.
Are you sure that your text file is UTF8 compatible? Otherwise, I have no idea why it does not work other than the characters are not UTF8 characters. What text editor tool did you use? I do not know if notepad is UTF8 compatible, but I believe that WordPad can be set to be compatible. What version of IM are you using?
Re: Font for use with Hangul Jamo.
http://imagebin.ca/v/28QXCnUEjdlC
The screenshot above shows that Notepad++ sees the mychar.txt file as UTF-8 encoded.
The screenshot above shows that Notepad++ sees the mychar.txt file as UTF-8 encoded.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Font for use with Hangul Jamo.
Did you try the option about UTF8 without BOM? Just exploring all possibilities.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Font for use with Hangul Jamo.
If that does not work, then can you find another source for the font. Perhaps it is corrupt or malformed.
What version of IM?
What version of IM?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Font for use with Hangul Jamo.
Have you tried using -annotate to render it and to get the font metrics? See http://www.imagemagick.org/Usage/text/#font_info
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Font for use with Hangul Jamo.
Post a link to your font file and I can test on my Mac and see if it fails there, also.
Re: Font for use with Hangul Jamo.
Font File (Batang TTF): http://filebin.ca/28QaqWyNFumC/batang.ttc
Also: (How to place any unicode character of your choosing inside a Unicode encoded text file.)
To answer your question about -annotate 0 when I use that parameter I get a no image defined yet when I remove that parameter the image is output with a good looking Jamo character and also a '?' to the left of it.
***The thing about BOM seems to be the problem however I have not yet been able to write to a text file without BOM correctly yet from the PowerShell.
Also: (How to place any unicode character of your choosing inside a Unicode encoded text file.)
Code: Select all
$sCurChar = [char]::ConvertFromUtf32(0x1110)
If( Test-Path mychar.txt )
{
Remove-Item mychar.txt
}
Add-Content -Encoding UTF8 mychar.txt $sCurChar
***The thing about BOM seems to be the problem however I have not yet been able to write to a text file without BOM correctly yet from the PowerShell.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Font for use with Hangul Jamo.
What key combination produces the character you are testing?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Font for use with Hangul Jamo.
The problem is in your file mychar.txt. When I execute the Powershell commands ...
... I get 8 bytes in the file:
This is four characters: BOM, something else, carriage-return, line-feed.
Your font probably shows BOM as "?".
I don't know Powershell, and don't know how to do this correctly.
Code: Select all
$sCurChar = [char]::ConvertFromUtf32(0x1110)
Add-Content -Encoding UTF8 mychar.txt $sCurChar
Code: Select all
{ef}{bb}{bf}{e1}{84}{90}\r\n
Your font probably shows BOM as "?".
I don't know Powershell, and don't know how to do this correctly.
snibgo's IM pages: im.snibgo.com
Re: Font for use with Hangul Jamo.
That's OK because now that the problem is exposed I can go about solving it. I was out of my depth in terms of the actual hidden contents of the text file which you have so graciously shed light upon for me. Thank you very much I think I can handle things from here then.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Font for use with Hangul Jamo.
I downloaded your font file and type E into my BBEdit text editor set to UTF8 (no BOM) and this command worked fine.
Text File:
http://www.fmwconcepts.com/misc_tests/b ... batang.txt
Screensnap of BBEdit save dialog:
Command line:
Resulting Image:
Note your font file is labeled with suffix .ttc Is that IM compatible? It seemed to work with no messages, but it could have not recognized it and used a default font. I am not an expert at fonts and those compatible with IM.
Text File:
http://www.fmwconcepts.com/misc_tests/b ... batang.txt
Screensnap of BBEdit save dialog:
Command line:
Code: Select all
convert -background white -fill black -font /Library/Fonts/batang.ttc -gravity center -pointsize 24 label:@batang.txt batang_E.png
Note your font file is labeled with suffix .ttc Is that IM compatible? It seemed to work with no messages, but it could have not recognized it and used a default font. I am not an expert at fonts and those compatible with IM.
Re: Font for use with Hangul Jamo.
My system sees the file as a True Type Font collection and for some reason TrueTypes seem to have different extensions all the time such as .fon .ttf and .ttc. This version of Batang is a font that is installed with Microsoft Office. It's available from Microsoft in stand alone form as well.
http://imagebin.ca/v/28QxGDHyWkMd
I have some code prepared that is supposed to strip of a BOM and I will be making a new push to my git repository once all this is done
You've been an amazing person. Thank you for helping.
http://imagebin.ca/v/28QxGDHyWkMd
I have some code prepared that is supposed to strip of a BOM and I will be making a new push to my git repository once all this is done
Code: Select all
(Get-Content $sMyPath) |
Foreach-Object {$_ -replace "\xEF\xBB\xBF", ""} |
Set-Content $sMyPath