示例#1
0
void CmdTextNormal(int code)

/****************************************************************************
 purpose: handle \textnormal{text}  {\normalfont ...} commands

     F_TEXT_NORMAL        for  \normalfont ... 
     F_TEXT_NORMAL_1
     F_TEXT_NORMAL_2      for  \textnormal{...}
     F_TEXT_NORMAL_3      for  \begin{normalfont} ... \end{normalfont}

 ******************************************************************************/
{
    int true_code = code & ~ON;

    diagnostics(5, "CmdTextNormal (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 (true_code == F_TEXT_NORMAL_3 && !(code & ON))
        return;

    if (getTexMode() == MODE_VERTICAL)
        changeTexMode(MODE_HORIZONTAL);

    if (code == F_TEXT_NORMAL_2)
        fprintRTF("{");

    if (CurrentFontShape() != DefaultFontShape())
        CmdFontShape(DefaultFontShape());

    if (CurrentFontSeries() != DefaultFontSeries())
        CmdFontSeries(DefaultFontSeries());

    if (CurrentFontSize() != DefaultFontSize())
        CmdFontSize(DefaultFontSize());

    if (CurrentFontFamily() != DefaultFontFamily())
        CmdFontFamily(DefaultFontFamily());

    if (code == F_TEXT_NORMAL_2) {
        char *s;

        s = getBraceParam();
        ConvertString(s);
        free(s);
        fprintRTF("}");
    }

    diagnostics(5, "CmdTextNormal (after) depth=%d, family=%d, size=%d, shape=%d, series=%d",
      FontInfoDepth, RtfFontInfo[FontInfoDepth].family,
      RtfFontInfo[FontInfoDepth].size, RtfFontInfo[FontInfoDepth].shape, RtfFontInfo[FontInfoDepth].series);
}
示例#2
0
void 
CmdFontSize(int code)
/******************************************************************************
 purpose : handles LaTeX commands that change the font size
******************************************************************************/
{
	int             scaled_size;

	diagnostics(4,"CmdFontSize (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 == F_SMALLER) 
		scaled_size = (int) (CurrentFontSize() / 1.2 + 0.5);
	else if (code == F_LARGER) 
		scaled_size = (int) (CurrentFontSize() * 1.2 + 0.5);
	else
		scaled_size = (int) (code * DefaultFontSize() / 20.0 + 0.5);

	fprintRTF("\\fs%d ", scaled_size);

	diagnostics(4,"CmdFontSize (after) depth=%d, family=%d, size=%d, shape=%d, series=%d",\
				   FontInfoDepth, RtfFontInfo[FontInfoDepth].family, \
	               RtfFontInfo[FontInfoDepth].size, RtfFontInfo[FontInfoDepth].shape,\
	               RtfFontInfo[FontInfoDepth].series);
}
示例#3
0
int TexFontNumber(const char *Fname)

/****************************************************************************
  purpose: returns the RTF font number for a particular LaTeX font
  example: TexFontNumber("Roman")
 ****************************************************************************/
{
    ConfigEntryT **p;
    int number=0;
    
    if (strcmp(Fname,"CurrentFontSize")==0)
        return CurrentFontSize();

    if (strcmp(Fname,"DefaultFontSize")==0)
        return DefaultFontSize();
                
    p = SearchCfgEntry(Fname, FONT_A);
    
    if (p) number = (**p).original_id;
        
    diagnostics(6,"TexFontNumber for '%s' is %d", Fname, number);
    
    return number;
}