On 9/26/2018 2:14 PM, Jeong Dal wrote:
Dear Hans,
I tested for more characters and found an interesting fact.
If the first consonant and the vowels are connected in a glyph, then the
outlining works OK, otherwise, it makes outline of the first consonant only.
you need to send a file not embedded .. otherwise the mail agent will
apply magic to korean
Here is a MWE.
Thank you.
Best regards,
Dalyoung
%%%%%
\definefontfeature
[korean-base]
[goodies=hanbatanglvt,
colorscheme=default,
mode=node,
script=hang,
language=kor]
\definefont[KoreanFont][hanbatanglvt*korean-base]
\starttext
\startMPdefinitions
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 ;
\stopMPdefinitions
% entered as three characters: ᄅ ᅡ ᆺ (mail collapses)
\startMPpage
KoreanOutline("\KoreanFont 랏") ;
\stopMPpage
\startMPpage
KoreanOutline("\KoreanFont 논") ;
\stopMPpage
\startMPpage
KoreanOutline("\KoreanFont 왕") ;
\stopMPpage
\startMPpage
KoreanOutline("\KoreanFont 닭") ;
\stopMPpage
\startMPpage
KoreanOutline("\KoreanFont 박") ;
\stopMPpage
\startMPpage
KoreanOutline("\KoreanFont 서") ;
\stopMPpage
%%%%%%%%%
2018. 9. 26. 오후 7:10, Hans Hagen <j.ha...@xs4all.nl> 작성:
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
-----------------------------------------------------------------
--
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________