int CurrentCyrillicFontFamily(void) /****************************************************************************** purpose: returns the cyrillic font that should be used ... if the current font is cyrillic font then -1 is returned ******************************************************************************/ { int num,i; char *font_type; ConfigEntryT **font_handle; num = CurrentFontFamily(); /* obtain name and type of current active font */ font_handle = CfgStartIterate(FONT_A); for (i=0; i<=num-3; i++) font_handle = CfgNext(FONT_A, font_handle); font_type = (char *) (*font_handle)->TexCommand; diagnostics(6,"CurrentCyrillicFontFamily current active font type =<%s>", font_type); if (strncmp(font_type, "Cyrillic", 8)==0) return -1; if (strcmp(font_type, "Slanted")==0) return TexFontNumber("Cyrillic Slanted"); if (strcmp(font_type, "Sans Serif")==0) return TexFontNumber("Cyrillic Sans Serif"); if (strcmp(font_type, "Typewriter")==0) return TexFontNumber("Cyrillic Typewriter"); return TexFontNumber("Cyrillic Roman"); }
int RtfFontNumber(char *Fname) /**************************************************************************** * purpose: returns the RTF font number from an RTF font name example: RtfFontNumber("Times") ****************************************************************************/ { int num = 0; ConfigEntryT **config_handle = CfgStartIterate(FONT_A); while ((config_handle = CfgNext(FONT_A, config_handle)) != NULL) { diagnostics(4,"font name =%s", (*config_handle)->RtfCommand); if (strcmp((*config_handle)->RtfCommand, Fname) == 0) { return num+3; } num++; } return TexFontNumber("Roman"); /* default font */ }
/**************************************************************************** * purpose: returns the RTF font number from an RTF font name example: RtfFontNumber("Times") ****************************************************************************/ int RtfFontNumber(const char *Fname) { ConfigEntryT **config_handle; char *font_type, *font_name; int font_id; diagnostics(6, "seeking=%s", Fname); config_handle = CfgStartIterate(); while ((config_handle = CfgNext(FONT_A, config_handle)) != NULL) { font_type = (char *) (*config_handle)->TexCommand; font_name = (char *) (*config_handle)->RtfCommand; font_id = (int ) (*config_handle)->original_id; diagnostics(6, "RTF font %d has name='%s' of type='%s'", font_id, font_name, font_type); if (strcmp(font_name, Fname) == 0) return font_id; } return TexFontNumber("Roman"); /* default font */ }
void CmdFontFamily(int code) /****************************************************************************** purpose: selects the appropriate font family F_FAMILY_ROMAN for \rmfamily F_FAMILY_ROMAN_1 for \rm F_FAMILY_ROMAN_2 for \textrm{...} F_FAMILY_ROMAN_3 for \begin{rmfamily} or \end{rmfamily} ******************************************************************************/ { char *s; int num, true_code; true_code = code & ~ON; diagnostics(4,"CmdFontFamily (before) depth=%d, family=%d, size=%d, shape=%d, series=%d",\ FontInfoDepth, RtfFontInfo[FontInfoDepth].family, \ RtfFontInfo[FontInfoDepth].size, RtfFontInfo[FontInfoDepth].shape,\ RtfFontInfo[FontInfoDepth].series); if (!(code & ON) && (true_code == F_FAMILY_CALLIGRAPHIC_3 || true_code ==F_FAMILY_TYPEWRITER_3 || true_code == F_FAMILY_SANSSERIF_3 || true_code == F_FAMILY_ROMAN_3 || true_code ==F_FAMILY_TYPEWRITER_4 || true_code == F_FAMILY_SANSSERIF_4 || true_code == F_FAMILY_ROMAN_4 ) ) return; switch (true_code) { case F_FAMILY_ROMAN: case F_FAMILY_ROMAN_1: case F_FAMILY_ROMAN_2: case F_FAMILY_ROMAN_3: case F_FAMILY_ROMAN_4: num = TexFontNumber("Roman"); break; case F_FAMILY_SANSSERIF: case F_FAMILY_SANSSERIF_1: case F_FAMILY_SANSSERIF_2: case F_FAMILY_SANSSERIF_3: case F_FAMILY_SANSSERIF_4: num = TexFontNumber("Sans Serif"); break; case F_FAMILY_TYPEWRITER: case F_FAMILY_TYPEWRITER_1: case F_FAMILY_TYPEWRITER_2: case F_FAMILY_TYPEWRITER_3: case F_FAMILY_TYPEWRITER_4: num = TexFontNumber("Typewriter"); break; case F_FAMILY_CALLIGRAPHIC: case F_FAMILY_CALLIGRAPHIC_1: case F_FAMILY_CALLIGRAPHIC_2: case F_FAMILY_CALLIGRAPHIC_3: num = TexFontNumber("Calligraphic"); break; } switch (true_code) { case F_FAMILY_ROMAN: case F_FAMILY_SANSSERIF: case F_FAMILY_TYPEWRITER: case F_FAMILY_CALLIGRAPHIC: case F_FAMILY_ROMAN_3: case F_FAMILY_SANSSERIF_3: case F_FAMILY_TYPEWRITER_3: case F_FAMILY_CALLIGRAPHIC_3: fprintRTF("\\f%d ", num); break; case F_FAMILY_ROMAN_1: case F_FAMILY_SANSSERIF_1: case F_FAMILY_TYPEWRITER_1: case F_FAMILY_ROMAN_4: case F_FAMILY_SANSSERIF_4: case F_FAMILY_TYPEWRITER_4: fprintRTF("\\i0\\scaps0\\b0\\f%d ", num); break; case F_FAMILY_ROMAN_2: case F_FAMILY_SANSSERIF_2: case F_FAMILY_TYPEWRITER_2: case F_FAMILY_CALLIGRAPHIC_2: fprintRTF("{\\f%d ", num); s = getBraceParam(); ConvertString(s); free(s); fprintRTF("}"); break; } diagnostics(4,"CmdFontFamily (after) depth=%d, family=%d, size=%d, shape=%d, series=%d",\ FontInfoDepth, RtfFontInfo[FontInfoDepth].family, \ RtfFontInfo[FontInfoDepth].size, RtfFontInfo[FontInfoDepth].shape,\ RtfFontInfo[FontInfoDepth].series); }