/* * tOpenFont - make the specified font the current font * * Returns the font reference number for use in a draw file */ drawfile_fontref tOpenFont(UCHAR ucWordFontNumber, USHORT usFontStyle, USHORT usWordFontSize) { os_error *e; const char *szOurFontname; font_handle tFont; int iFontnumber; NO_DBG_MSG("tOpenFont"); NO_DBG_DEC(ucWordFontNumber); NO_DBG_HEX(usFontStyle); NO_DBG_DEC(usWordFontSize); /* Keep the relevant bits */ usFontStyle &= FONT_BOLD|FONT_ITALIC; NO_DBG_HEX(usFontStyle); iFontnumber = iGetFontByNumber(ucWordFontNumber, usFontStyle); szOurFontname = szGetOurFontname(iFontnumber); if (szOurFontname == NULL || szOurFontname[0] == '\0') { tFontCurr = (font_handle)-1; return (byte)0; } NO_DBG_MSG(szOurFontname); e = Font_FindFont(&tFont, (char *)szOurFontname, (int)usWordFontSize * 8, (int)usWordFontSize * 8, 0, 0); if (e != NULL) { switch (e->errnum) { case 523: werr(0, "%s", e->errmess); break; default: werr(0, "Open font error %d: %s", e->errnum, e->errmess); break; } tFontCurr = (font_handle)-1; return (drawfile_fontref)0; } tFontCurr = tFont; NO_DBG_DEC(tFontCurr); return (drawfile_fontref)(iFontnumber + 1); } /* end of tOpenFont */
/* * tOpenFont - make the specified font the current font * * Returns the font reference number */ drawfile_fontref tOpenFont(UCHAR ucWordFontNumber, USHORT usFontStyle, USHORT usWordFontSize) { options_type tOptions; const char *szOurFontname; size_t tIndex; int iFontnumber; NO_DBG_MSG("tOpenFont"); NO_DBG_DEC(ucWordFontNumber); NO_DBG_HEX(usFontStyle); NO_DBG_DEC(usWordFontSize); /* Keep the relevant bits */ usFontStyle &= FONT_BOLD|FONT_ITALIC; NO_DBG_HEX(usFontStyle); vGetOptions(&tOptions); eEncoding = tOptions.eEncoding; bUsePlainText = tOptions.eConversionType != conversion_draw && tOptions.eConversionType != conversion_ps && tOptions.eConversionType != conversion_pdf; if (bUsePlainText) { /* Plain text, no fonts */ return (drawfile_fontref)0; } iFontnumber = iGetFontByNumber(ucWordFontNumber, usFontStyle); szOurFontname = szGetOurFontname(iFontnumber); if (szOurFontname == NULL || szOurFontname[0] == '\0') { DBG_DEC(iFontnumber); return (drawfile_fontref)0; } NO_DBG_MSG(szOurFontname); for (tIndex = 0; tIndex < elementsof(szFontnames); tIndex++) { if (STREQ(szFontnames[tIndex], szOurFontname)) { NO_DBG_DEC(tIndex); return (drawfile_fontref)tIndex; } } return (drawfile_fontref)0; } /* end of tOpenFont */