From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- support/w2latex/rtf.fonts.c | 246 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 246 insertions(+) create mode 100644 support/w2latex/rtf.fonts.c (limited to 'support/w2latex/rtf.fonts.c') diff --git a/support/w2latex/rtf.fonts.c b/support/w2latex/rtf.fonts.c new file mode 100644 index 0000000000..c277c19afa --- /dev/null +++ b/support/w2latex/rtf.fonts.c @@ -0,0 +1,246 @@ +#define MaxFontsTex 21 +typedef struct _E_Q_FONTS_ { char * FontRTF; char * FontTeX; } EQFonts; +EQFonts EqFontsRTF_TeX[MaxFontsTex]= +{ { "Times New Roman", "\\pzrm " }, + { "Arial", "\\pzrm " }, + { "AvantGarde", "\\pzrm " }, + { "Bookman", "\\pzrm " }, + { "Courier", "\\tt " }, + { "Courier New", "\\tt " }, + { "Fences", "\\pzrm " }, + { "Helvetica", "\\pzrm\\bf " }, + { "Helvetica-Narrow", "\\pzrm " }, + { "Modern", "\\pzrm " }, + { "MS LineDraw", "\\pzrm " }, + { "MT Extra", "\\pzrm " }, + { "NewCenturySchlbk", "\\pzrm " }, + { "Palatino", "\\pzrm " }, + { "Roman", "\\pzrm " }, + { "Script", "\\pzrm\\it " }, + { "Symbol", "\\pzrm " }, + { "Times", "\\pzrm " }, + { "Wingdings", "\\pzrm " }, + { "ZapfChancery", "\\pzrm \\it " }, + { "ZapfDingbats", "\\pzrm " }, +}; +typedef struct _E_Q_TAILLES_ { int tailleRTF; char * tailleTeX; } EQTailles; +#define MaxTaillesTex 25 +EQTailles EqTailles_TeX[MaxTaillesTex]= +{ { 1, "\\tiny " }, { 2, "\\tiny " }, { 3, "\\tiny " }, { 4, "\\tiny " }, { 5, "\\tiny " }, + { 6, "\\tiny " }, { 7, "\\scriptsize " }, { 8, "\\footnotesize " }, { 9, "\\small " }, + { 10, "\\normalsize " }, { 11, "\\normalsize " }, { 12, "\\large " }, { 13, "\\large " }, { 14, "\\Large " }, + { 15, "\\Large " }, { 16, "\\Large " }, { 17, "\\LARGE " }, { 18, "\\LARGE " }, { 19, "\\LARGE " }, + { 20, "\\huge " }, { 21, "\\huge " }, { 22, "\\huge " }, { 23, "\\huge " }, { 24, "\\huge " }, + { 25, "\\Huge " }, +}; +#define MaxSymboles 256 +char FontSymboles[MaxSymboles][25]= +{ "@","@","@","@","@","@","@","@", + "@","@","@","@","@","@","@","@", + "@","@","@","@","@","@","@","@", + "@","@","@","@","@","@","@","@", + "","!","\\forall ","\\#=","\\exists ","\\%","\\&","\\exists ", + "(",")","*","+",",","-",".","/", + "0","1","2","3","4","5","6","7", + "8","9",":",";","<","=",">","?", + "\\cong ","A","B","X","\\Delta ","E","\\Phi ","\\Gamma ", + "H","I","\\vartheta ","K","\\Lambda ","M","N","O", + "\\Pi ","\\Theta ","P","\\Sigma ","T","Y","\\varsigma ","\\Omega ", + "\\Xi ","\\Psi ","Z","[","\\, ","]","\\perp ","\\_", + "\\_","\\alpha ","\\beta ","\\chi ","\\delta ","\\varepsilon ","\\phi ","\\gamma ", + "\\eta ","\\iota ","\\varphi ","\\kappa ","\\lambda ","\\mu ","\\nu ","o", + "\\pi ","\\theta ","\\rho ","\\sigma ","\\tau ","\\upsilon ","\\varpi ","\\omega ", + "\\xi ","\\psi ","\\zeta ","\\{","|","\\}","\\~{}","@", + "@","@","@","@","@","@","@","@", + "@","@","@","@","@","@","@","@", + "@","@","@","@","@","@","@","@", + "@","@","@","@","@","@","@","@", + "@","\\Upsilon ","'","\\leq ","/","\\infinity ","f","\\clubsuit ", + "\\diamondsuit ","\\heartsuit ","\\spadesuite ","\\leftrightarrow ","\\leftarrow ", + "\\uparrow ","\\rightarrow ","\\downarrow ", + "\\circ ","\\pm ","@","\\geq ","\\times ","\\propto ","\\partial ","\\bullet ", + "\\div ","\\neq ","\\equiv ","\\approx ","\\cdots ","\\mid","-","\\hookleftarrow ", + "\\aleph ","\\Im ","\\Re ","@","\\otimes ","\\oplus ","\\oslash ","\\cap ", + "\\cup ","\\supset ","\\supseteq ","\\not\\subset ","\\subset ","\\subseteq ","\\in ","\\not\\in ", + "\\angle ","\\bigtriangledown ","\\copyright ","\\copyright ","\\copyright ","\\Pi ","\\surd ","\\cdot ", + "\\neg ","\\wedge ","\\vee ","\\Leftrightarrow ","\\Leftarrow ","\\Uparrow ","\\Rightarrow ","\\Downarrow ", + "\\diamond ","\\angle ","\\copyright ","\\copyright ","\\copyright ","\\Sigma ","{\\mathex \\char'060 }", + "{\\mathex \\char'102 }", + "{\\mathex \\char'100 }","{\\mathex \\char'062 }","{\\mathex \\char'102 }","{\\mathex \\char'064 }", + "{\\mathex \\char'070 }","{\\mathex \\char'074 }","{\\mathex \\char'072 }","{\\mathex \\char'102 }", + "@","{\\mathex \\char'105 }","{\\mathex \\char'122 }","{\\mathex \\char'070 }","{\\mathex \\char'102 }","{\\mathex \\char'073 }", + "{\\mathex \\char'061 }","{\\mathex \\char'102 }", + "{\\mathex \\char'101 }","{\\mathex \\char'063 }","{\\mathex \\char'102 }","{\\mathex \\char'065 }", + "{\\mathex \\char'071 }","{\\mathex \\char'075 }","{\\mathex \\char'073 }","@" +}; + +char * chercheEqTeX(char * ); +/************************************************************************************************** +** Function name : nouvfonte +** +** Description : Cree un nouveau maillon avec la description d'une fonte +** Input : Declarations sur les fontes +** Output : Pointeur sur le maillon cree. +**************************************************************************************************/ +p_LFonte nouvfonte(int NLF_Fontnum, int NLF_Fontfamily, int NLF_Fcharset, + int NLF_Fprq, char * NLF_Fontname) +{ + p_LFonte LFtemp=DebLisFontes; + char * pcalutemp; + if (LFtemp!=NULL) + { + while(LFtemp->suiv!=NULL) + LFtemp=LFtemp->suiv; + LFtemp->suiv=(p_LFonte) malloc (sizeof(t_LFonte)); + LFtemp=LFtemp->suiv; + } + else + { + LFtemp=(p_LFonte) malloc (sizeof(t_LFonte)); + DebLisFontes=LFtemp; + }; + LFtemp->LF_Fontnum=NLF_Fontnum; + LFtemp->LF_Fontfamily=NLF_Fontfamily; + LFtemp->LF_Fcharset=NLF_Fcharset; + LFtemp->LF_Fprq=NLF_Fprq; + LFtemp->LF_Fontname=(char *) malloc (strlen(NLF_Fontname)+1); + strcpy(LFtemp->LF_Fontname,NLF_Fontname); + pcalutemp=chercheEqTeX(NLF_Fontname); + LFtemp->LF_TexEquiv=(char *) malloc (strlen(pcalutemp)+1); + strcpy(LFtemp->LF_TexEquiv,pcalutemp); + LFtemp->suiv=NULL; +} + +/************************************************************************************************** +** Function name : cherchefonte +** +** Description : A partir du numero de fonte, cherche une fonte donnee. +** Input : Numero de fonte. +** Output : Pointeur sur le maillon contenant les caracteristiques. +**************************************************************************************************/ +p_LFonte cherchefonte(int CLFnum) +{ + p_LFonte LFtemp=DebLisFontes; + while (LFtemp!=NULL && LFtemp->LF_Fontnum!=CLFnum) + LFtemp=LFtemp->suiv; + return LFtemp; +} + +/************************************************************************************************** +** Function name : parcoursfontes +** +** Description : +** Input : +** Output : +**************************************************************************************************/ +parcoursfontes() +{ +/* p_LFonte LFtemp=DebLisFontes; + while (LFtemp!=NULL) + { + fprintf(stderr,"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"); + fprintf(stderr,"LF_Fontnum:%d;\nLF_Fontfamily:%d;\n",LFtemp->LF_Fontnum,LFtemp->LF_Fontfamily); + fprintf(stderr,"LF_Fcharset:%d;\nLF_Fprq:%d;\n",LFtemp->LF_Fcharset,LFtemp->LF_Fprq); + fprintf(stderr,"LF_Fontname:%s;\nLF_TexEquiv%s\n",LFtemp->LF_Fontname,LFtemp->LF_TexEquiv); + fprintf(stderr,"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"); + LFtemp=LFtemp->suiv; + }*/ +} + +/************************************************************************************************** +** Function name : chercheEqTeX +** +** Description : Cherche un equivalent TeX pour un nom de fonte RTF +** Input : Nom de la fonte RTF +** Output : Equivalent TeX (ou police par defaut sinon. +**************************************************************************************************/ +char * chercheEqTeX(char * FontNameRTF) +{ + int i; + for (i=0;iMaxTaillesTex) + return EqTailles_TeX[MaxTaillesTex-1].tailleTeX; + return EqTailles_TeX[TailleRTF-1].tailleTeX; +} + +/************************************************************************************************** +** Function name : printSymbol +** +** Description : +** Input : char * chaineIN +** Output : void +**************************************************************************************************/ +void printSymbol(char * chaineIN) +{ + int i=0; + for (i=0;i') && FLAG_Equation==0) + { + fprintf(SORT,"$%c$",chaineIN[i]); + } + else fprintf(SORT,"%c",chaineIN[i]); + } +} + +/************************************************************************************************** +** Function name : printApostrophe +** +** Description : +** Input : int ulluIN +** Output : void +**************************************************************************************************/ +void printApostrophe(int ulluIN) +{ + if (FLAG_Equation==0) + { + if (ulluIN<238) + fprintf(SORT,"$%s$",FontSymboles[ulluIN]); + else + fprintf(SORT,"%s",FontSymboles[ulluIN]); + } + else + { + if (ulluIN<238) + fprintf(SORT,"%s",FontSymboles[ulluIN]); + else + fprintf(SORT,"$%s$",FontSymboles[ulluIN]); + } +} + -- cgit v1.2.3