ó LzñWc@s`dZddlZddlZddlZdd„Zdd d„ƒYZdd d„ƒYZdS( sË Provide an encoder for a font specification configuration: the encoder is fed with Unicode characters one by one and determines the needed font switches between the preceding and the current character. iÿÿÿÿNicCs*d|}||j|jdƒƒ}|S(s6Indent the lines by blank characters.t i(tjoint splitlines(tstringtwidthtistrts((sB/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/xetex/fontspec.pyt_indents tUnicodeIntervalcBs\eZdZejdƒZd„Zd„Zd„Zd„Z d„Z d„Z d„Z RS( s¶Unicode codepoint interval, including all codepoints between its minimum and maximum boundary. For any Unicode codepoint it can be queried if it belongs to the interval. s^[Uu]\+?([0-9A-Fa-f]+)$cCsd|_d|_dS(Ni(t _min_boundaryt _max_boundary(tself((sB/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/xetex/fontspec.pyt__init__"s cCsMdt|jƒ}|j|jkr?|dt|jƒ7}n|d7}|S(s$Dump the instance's data attributes.t[t,t](tstrR R (R R((sB/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/xetex/fontspec.pyt__str__&s  cCs?|jj|ƒ}|r.t|jdƒdƒStd|‚dS(s.Return the ordinal of the specified codepoint.iisNot a unicode codepoint: N(t _re_codepointtmatchtinttgroupt RuntimeError(R t codepointtm((sB/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/xetex/fontspec.pyt_unicode_to_ordinal.scCst|ƒ|_|j|_|S(sInterval for a single character(tordR R (R tchar((sB/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/xetex/fontspec.pyt from_char6s cCs"|j|ƒ|_|j|_|S(s:Interval for a single character defined as unicode string.(RR R (R R((sB/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/xetex/fontspec.pytfrom_codepoint<s cCsV|j|ƒ|_|j|ƒ|_|j|jkrR|j|j|_|_n|S(sInterval from a unicode range.(RR R (R t codepoint1t codepoint2((sB/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/xetex/fontspec.pyt from_intervalBs cCs(t|ƒ|jko't|ƒ|jkS(sm Determine whether the specified character is contained in this instance's interval. (RR R (R R((sB/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/xetex/fontspec.pytcontainsKs( t__name__t __module__t__doc__tretcompileRR RRRRR R!(((sB/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/xetex/fontspec.pyRs      tFontSpeccBsõeZdZdddgZejdƒZejdƒZde d„Z d„Z d„Z d „Z d „Zd „Zd „Zd „Zd„Zd„Zd„Zd„Zdd„Zdd„Zd„Zd„Zd„Zd„Zdd„ZRS(s¼ Font specification, consisting of one or several unicode character intervals and of fonts to select for those characters. The object fully defines the fonts to switch to. tentertintertexits'^([Uu][0-9A-Fa-f]+)-([Uu][0-9A-Fa-f]+)$s^([Uu][0-9A-Fa-f]+)$cCs¿d|_d|_d|_i|_|g|_||_g|_tj dƒ|_ x|j D]}i|j|R/R0Rttransition_type((sB/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/xetex/fontspec.pytfromnode|s    cCs*|jdjdƒp)|jdjdƒS(NR(tmaintsans(R1tget(R ((sB/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/xetex/fontspec.pytmainfont’scCsÄg}|jƒ}x«|D]£}|jj|ƒ}|rntƒj|jdƒ|jdƒƒ}|j|ƒq|jj|ƒ}|r«|jtƒj|jdƒƒƒqt d|d‚qW|S(s_Parse the specified /fonts/fontspec@range attribute to a UnicodeInterval list. iisUnable to parse range: "t"( tsplitt _re_intervalRRR RtappendRRR(R R=R<tchunkstchunkRturange((sB/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/xetex/fontspec.pyR@—s  'c CsÀ|j|}x¬|j|ƒD]›}x’|jdƒD]}d}|jdƒ}|jƒ}x3|jD](}|j|jkrd||j7}qdqdW|r3x|D]} ||| %siÿÿÿÿ(R7R_R/R3R2tinsertRM(R tfontspec((sB/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/xetex/fontspec.pyt add_subfontãs  cCs |jjtƒj|ƒƒdS(N(R9RMRR(R R((sB/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/xetex/fontspec.pyRAêsicCsM|r9x0|jD]"}||kr|j|ƒqqWn|jj|ƒdS(N(R2t add_urangesR9textend(R trangestdepthtf((sB/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/xetex/fontspec.pyReís  cCsM|r9x0|jD]"}||kr|j|ƒqqWn|jj|ƒdS(N(R2t add_ignoredR4Rf(R RgRhRi((sB/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/xetex/fontspec.pyRjõs  cCs|jS(N(R9(R ((sB/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/xetex/fontspec.pyt get_urangesüscCs/x(|jD]}|j|ƒr tSq WtSdS(N(R9R!tTruetFalse(R RRa((sB/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/xetex/fontspec.pyR!ÿscCsh|jjd|jg|jD]}t|ƒ^qfƒx(|jD]}|j|ƒrCtSqCWtSdS(Ns%s: %s(R7R_R/R4RR!RlRm(R RtaRa((sB/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/xetex/fontspec.pyt isignoreds 9cCsRy$|jjd|t|ƒfƒWn'|jjd|t|ƒfƒnXdS(Ns %s has '%s'(R7R_RR(R R/R((sB/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/xetex/fontspec.pyt_loghass$cCs“d}|jjd|jƒ|j|ƒrC|j|j|ƒ|SxI|jD]>}||kreqMn|j|ƒrM|j|j|ƒ|SqMWdS(stDetermine whether the font specification matches the specified object, thereby considering refmode. s Lookup in %sN(R.R7R_R/RoRpR2R!(R RtexcludedRc((sB/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/xetex/fontspec.pyRs N(R"R#R$R8R%R&RLRR.RmR RERIR@RBR^R(R*R`RRdRAReRjRkR!RoRpR(((sB/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/xetex/fontspec.pyR'Us.               (((R$R%txml.dom.minidomtxmlR5RRR'(((sB/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/xetex/fontspec.pyt s     ?