On 09/17/2012 07:11 PM, Pavel Dohnal wrote:
Hello, I am creating script which generates context source from database data. Then converts context to pdf and sends it to user. Problem is that users enter international texts into database and some characters are not present in final pdf. Here is my minimal example:
%interface=en translate-file=utf-8 \enableregime[utf] \starttext This is in Japan: 日本, 神奈川県藤沢市藤沢75 \stoptext
Now I run: context file.tex But japaneese character are missing in final pdf. You can see in attached file. Is there a way how to create documents which can be writen in any international language?
You need to load a font which contains Japanese characters. In order to create documents, which can be written in any international language, you need to make a typescript, which loads fonts for all languages (if that is really what you want). You can specify what Unicode range should be typeset in what font... Here is a typescript I used for a Japanese document, which also contained Korean Hangul, Vietnamese and the International Phonetic Alphabet. You can use it as a reference. --> type-mytypescript.mkiv <-- \definefontfeature[jpdefault][mode=node,script=latn,lang=jan,protrusion=pure,expansion=quality] \definefontfeature[hz][default][protrusion=pure,mode=node,script=latn] \def\mydefaultfeatures{kern=yes;liga=yes;tlig=yes;trep=yes} % Vietnamese 0x1EA0-0x1EF9 % Phonetic Ext 0x1D00-0x1D7F % Korean Hangul 0xAC00-0xD7A3 \definefontfallback[serifwhatever] [GenR102.ttf:\mydefaultfeatures] [0x0000-0x0400,0x1EA0-0x1EF9,0x1D00-0x1D7F] [force=yes] \definefontfallback[serifwhatever] [UnBatang.ttf:\mydefaultfeatures][0xAC00-0xD7A3] [force=yes] \definefontfallback[serifwhatever] [AdobeSongStd-Light.otf:\mydefaultfeatures][0x35C2,0x5987,0x7535,0x4E50,0x98CE,0x957F,0x9A6C][force=yes] \definefontfallback[serifboldwhatever] [GenBasB.ttf:\mydefaultfeatures] [0x0000-0x0400] [force=yes] \definefontfallback[serifitalicwhatever] [GenI102.ttf:\mydefaultfeatures] [0x0000-0x0400] [force=yes] \definefontfallback[serifbolditalicwhatever] [GenBasBI.ttf:\mydefaultfeatures][0x0000-0x0400] [force=yes] \definefontfallback[sanswhatever] [Andika-R.ttf:\mydefaultfeatures] [0x0000-0x0400] [force=yes] \starttypescript[serif][IPAexMincho] \definefontsynonym [ipaexmincho] [ipaexm.ttf] [features=jpdefault,fallbacks=serifwhatever] \definefontsynonym [ipaexminchobold] [ipaexm.ttf] [features=krdefault,fallbacks=serifboldwhatever] \definefontsynonym [ipaexminchoitalic] [ipaexm.ttf] [features=krslanted,fallbacks=serifitalicwhatever] \definefontsynonym [ipaexminchobolditalic] [ipaexm.ttf] [features=krslanted,fallbacks=serifbolditalicwhatever] \stoptypescript \starttypescript [serif][IPAexMincho][name] \definefontsynonym[Serif] [ipaexmincho] \definefontsynonym[SerifBold] [ipaexminchobold] \definefontsynonym[SerifItalic] [ipaexminchoitalic] \definefontsynonym[SerifBoldItalic] [ipaexminchobolditalic] \stoptypescript \starttypescript[sans][IPAexGothic] \definefontsynonym[ipaexgothic] [ipaexg.ttf] [features=jpdefault,fallbacks=sanswhatever] \stoptypescript \starttypescript[sans][IPAexGothic][name] \definefontsynonym[Sans] [ipaexgothic] \stoptypescript \starttypescript[mono][KanjiStrokeOrders] \definefontsynonym[kanjistrokeorders] [KanjiStrokeOrders_v2.016.ttf] [features=jpdefault] \stoptypescript \starttypescript[mono][KanjiStrokeOrders][name] \definefontsynonym[Mono] [kanjistrokeorders] \stoptypescript \starttypescript[MyIPAex] \definetypeface[Myface] [rm] [serif] [IPAexMincho] [default] [features=punctuation] \definetypeface[Myface] [ss] [sans] [IPAexGothic] [default] \definetypeface[Myface] [tt] [mono] [KanjiStrokeOrders] [default] [rscale=0.9] \stoptypescript --> END type-mytypescript.mkiv <-- --> file.tex <-- \usetypescriptfile[mytypescript] \usetypescript[MyIPAex] \definebodyfontenvironment[12pt] \setupbodyfont[Myface,rm,12pt] \starttext Place your text here. \stoptext --> END file.tex <-- Good luck. Severin