![](https://secure.gravatar.com/avatar/46562c7d27388490d62e8d7a5bc960dd.jpg?s=120&d=mm&r=g)
On 9/26/2018 1:48 AM, Jeong Dal wrote:
Dear Hans,
First, it is great to know a new method of drawing an outlined font!
I have applied it to Korean fonts. As you know, every Korean character is composed with “consonant+vowel(+consonant)” type. If consonant and vowel are connected (for example, “호”), then it draws correctly, otherwise (for example, “하”) it draws only consonant. Is there a way to count all the paths in a character(even if it is not connected)? I assume that you want to identify the upto 3 snippets in a glyph so what you can do is loop over a picture.
\definefontfeature [korean-base] [goodies=hanbatanglvt, colorscheme=default, mode=node, script=hang, language=kor] \definefont[KoreanFont][hanbatanglvt*korean-base] \starttext \startMPpage string KoreanColors[] ; KoreanColors[1] := "darkred" ; KoreanColors[2] := "darkgreen" ; KoreanColors[3] := "darkblue" ; KoreanColors[4] := "darkyellow" ; KoreanColors[5] := "darkgray" ; def KoreanOutline(expr txt) = picture p ; p := outlinetext.p(txt) ; numeric n ; n := 0 ; string old, new ; old := "" ; for i within p : new := prescriptpart i ; if (new = "") or (new <> old) : old := new ; n := n + 1 ; if unknown KoreanColors[n] : n := 1 ; fi ; fi ; draw pathpart i withpen pencircle scaled 1/10 withcolor KoreanColors[n] ; endfor ; enddef ; % entered as three characters: ᄅ ᅡ ᆺ (mail collapses) KoreanOutline("\KoreanFont 랏") ; \stopMPpage \stoptext The prescript will be set in a next beta so then you get better results for more complex shapes. Loading the font takes a bit of time and memory because the first time the outlines are filtered and converted and saved. But I assume Koreans TeX users have fast computers with lots of memory. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------