From 91bceadf7c20ba55211376abd5cd5b3fafde8664 Mon Sep 17 00:00:00 2001 From: faa Date: Fri, 29 May 2009 15:20:42 +0000 Subject: [PATCH] hershey font cyrillic support (only utf8) --- common/common_plot_functions.cpp | 18 ++++----- common/drawtxt.cpp | 17 ++++++++ include/hershey_fonts.h | 69 ++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 9 deletions(-) diff --git a/common/common_plot_functions.cpp b/common/common_plot_functions.cpp index e9aa0320a5..b63b76b1e9 100644 --- a/common/common_plot_functions.cpp +++ b/common/common_plot_functions.cpp @@ -164,7 +164,7 @@ void WinEDA_DrawFrame::PlotWorkSheet( int format_plot, BASE_SCREEN* screen ) PlotGraphicText(format_plot, pos, color, msg, TEXT_ORIENT_VERT, text_size, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, - thickness, italic, false, false ); + thickness, italic, false ); break; case WS_SEGMENT_LU: @@ -293,7 +293,7 @@ void WinEDA_DrawFrame::PlotWorkSheet( int format_plot, BASE_SCREEN* screen ) if(WsItem->m_Legende) msg = WsItem->m_Legende; PlotGraphicText(format_plot, pos, color, msg, TEXT_ORIENT_HORIZ,text_size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, - thickness, italic, false, false ); + thickness, italic, false ); break; case WS_SIZESHEET: break; @@ -302,14 +302,14 @@ void WinEDA_DrawFrame::PlotWorkSheet( int format_plot, BASE_SCREEN* screen ) msg << screen->m_ScreenNumber; PlotGraphicText(format_plot, pos, color, msg, TEXT_ORIENT_HORIZ,text_size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, - thickness, italic, false, false ); + thickness, italic, false ); break; case WS_SHEETS: if(WsItem->m_Legende) msg = WsItem->m_Legende; msg << screen->m_NumberOfScreen; - PlotGraphicText(format_plot, pos, color, msg, TEXT_ORIENT_HORIZ,text_size, + PlotGraphicText(format_plot, pos, color, msg, TEXT_ORIENT_HORIZ, text_size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, - thickness, italic, false, false ); + thickness, italic, false ); break; case WS_COMPANY_NAME: break; @@ -346,16 +346,16 @@ void WinEDA_DrawFrame::PlotWorkSheet( int format_plot, BASE_SCREEN* screen ) /* Begin list number > 1 */ case WS_PODPIS_D: if(WsItem->m_Legende) msg = WsItem->m_Legende; - PlotGraphicText(format_plot, pos, color, msg, TEXT_ORIENT_HORIZ,text_size, + PlotGraphicText(format_plot, pos, color, msg, TEXT_ORIENT_HORIZ, text_size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, - thickness, italic, false, false ); + thickness, italic, false ); break; case WS_IDENTSHEET_D: if(WsItem->m_Legende) msg = WsItem->m_Legende; msg << screen->m_ScreenNumber; - PlotGraphicText(format_plot, pos, color, msg, TEXT_ORIENT_HORIZ,text_size, + PlotGraphicText(format_plot, pos, color, msg, TEXT_ORIENT_HORIZ, text_size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, - thickness, italic, false, false ); + thickness, italic, false ); break; case WS_LEFT_SEGMENT_D: case WS_SEGMENT_D: diff --git a/common/drawtxt.cpp b/common/drawtxt.cpp index d805688702..7d0703d89b 100644 --- a/common/drawtxt.cpp +++ b/common/drawtxt.cpp @@ -51,6 +51,23 @@ int NegableTextLength( const wxString& aText ) static const char* get_hershey_recipe( int AsciiCode, bool bold ) { + +#if defined(KICAD_CYRILLIC) + AsciiCode &= 0x7FF; + if( AsciiCode > 0x40F && AsciiCode < 0x450 ) // big small Cyr + { + return hershey_cyrillic[AsciiCode - 0x410]; + } + else if( AsciiCode == 0x401 ) + { + return hershey_cyrillic[0x5]; + } + else if( AsciiCode == 0x451 ) + { + return hershey_cyrillic[0x25]; + } +#endif + AsciiCode &= 0x7F; if( AsciiCode < 32 ) AsciiCode = 32; /* Clamp control chars */ diff --git a/include/hershey_fonts.h b/include/hershey_fonts.h index 43d9fda079..147a058bae 100644 --- a/include/hershey_fonts.h +++ b/include/hershey_fonts.h @@ -236,3 +236,72 @@ const static char* hershey_duplex[] = "F^IUISJPLONOPPTSVTXTZS[Q RISJQLPNPPQTTVUXUZT[Q[O", "KYQFOGNINKOMQNSNUMVKVIUGSFQF RQFNIOMSNVKUGQF RSFOGNKQNUMVISF" }; +#if defined(KICAD_CYRILLIC) +const static char* hershey_cyrillic[] = +{ + "H\\RFK[ RRFY[ RRIX[ RMUVU RI[O[ RU[[[", + "G]LFL[ RMFM[ RIFYFYLXF RMPUPXQYRZTZWYYXZU[I[ RUPWQXRYTYWXYWZU[", + "G]LFL[ RMFM[ RIFUFXGYHZJZLYNXOUP RUFWGXHYJYLXNWOUP RMPUPXQYRZTZWYYXZU[I[ RUPWQXRYTYWXYWZU[", + "I[NFN[ ROFO[ RKFZFZLYF RK[R[", + "F^NFNLMTLXKZJ[ RXFX[ RYFY[ RKF\\F RG[\\[ RG[Gb RH[Gb R[[\\b R\\[\\b", + "G\\LFL[ RMFM[ RSLST RIFYFYLXF RMPSP RI[Y[YUX[", + "CbRFR[ RSFS[ ROFVF RGGHHGIFHFGGFHFIGJIKMLONPWPYOZM[I\\G]F^F_G_H^I]H^G RNPLQKSJXIZH[ RNPMQLSKXJZI[G[FZEX RWPYQZS[X\\Z][ RWPXQYSZX[Z\\[^[_Z`X RO[V[", + "H\\LIKFKLLINGPFTFWGXIXLWNTOQO RTFVGWIWLVNTO RTOVPXRYTYWXYWZT[O[MZLYKWKVLUMVLW RWQXTXWWYVZT[", + "F^KFK[ RLFL[ RXFX[ RYFY[ RHFOF RUF\\F RXHLY RH[O[ RU[\\[", + "F^KFK[ RLFL[ RXFX[ RYFY[ RHFOF RUF\\F RXHLY RH[O[ RU[\\[ RN@N?M?M@NBPCTCVBW@", + "F^KFK[ RLFL[ RHFOF RLPSPUOVMWIXGYFZF[G[HZIYHZG RSPUQVSWXXZY[ RSPTQUSVXWZX[Z[[Z\\X RH[O[", + "E^MFMLLTKXJZI[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\\M\\[ R]M][ REMLM ROMVM RYM`M RE[`[``_[", + "H]QMQ[ RRMR[ RLMKRKMUM RRTVTYUZWZXYZV[N[ RVTXUYWYXXZV[", /* ъ */ + "E_JMJ[ RKMK[ RGMNM RKTOTRUSWSXRZO[G[ ROTQURWRXQZO[ RYMY[ RZMZ[ RVM]M RV[][", /* ы */ + "J[OMO[ RPMP[ RLMSM RPTTTWUXWXXWZT[L[ RTTVUWWWXVZT[", /* ь */ + "H]LIKFKLLINGQFSFVGXIYKZNZSYVXXVZS[P[MZLYKWKVLUMVLW RSFUGWIXKYNYSXVWXUZS[ RPPYP", /* э */ + "DaIMI[ RJMJ[ RFMMM RF[M[ RVMSNQPPSPUQXSZV[X[[Z]X^U^S]P[NXMVM RVMTNRPQSQURXTZV[ RX[ZZ\\X]U]S\\PZNXM RJTPT", /* ю */ + "G\\VMV[ RWMW[ RZMOMLNKPKQLSOTVT ROMMNLPLQMSOT RTTQUPVNZM[ RTTRUQVOZN[L[KZJX RS[Z[" /* я */ +}; +#endif