void PDF_DefineGraphicNames(OBJECT x) { assert( type(x) == GRAPHIC, "PrintGraphic: type(x) != GRAPHIC!" ); debug1(DPF, D, "DefineGraphicNames( %s )", EchoObject(x)); debug1(DPF, DD, " style = %s", EchoStyle(&save_style(x))); /* if font is different to previous word then print change */ if( font(save_style(x)) != currentfont ) { currentfont = font(save_style(x)); if( currentfont > 0 ) { currentxheight2 = FontHalfXHeight(currentfont); PDFFont_Set(out_fp, FontSize(currentfont, x), FontName(currentfont)); } } /* if colour is different to previous word then print change */ if( colour(save_style(x)) != currentcolour ) { currentcolour = colour(save_style(x)); if( currentcolour > 0 ) { char str[256]; sprintf(str, "%s ", ColourCommand(currentcolour)); PDFPage_Write(out_fp, str); } } PDFPage_SetVars(size(x, COLM), size(x, ROWM), back(x, COLM), fwd(x, ROWM), currentfont <= 0 ? 12*PT : FontSize(currentfont, x), width(line_gap(save_style(x))), width(space_gap(save_style(x)))); debug0(DPF, D, "PDF_DefineGraphicNames returning."); } /* end PDF_DefineGraphicNames */
void ON_Font::Dump( ON_TextLog& dump ) const { const wchar_t* name = FontName(); if ( !name ) name = L""; dump.Print("font index = %d\n",m_font_index); dump.Print("font name = \"%S\"\n",name); dump.Print("font face name = \"%S\"\n",m_facename); dump.Print("font weight = \"%d\"\n",m_font_weight); dump.Print("font is italic = \"%d\"\n",m_font_italic); dump.Print("font linefeed ratio = \"%g\"\n", m_linefeed_ratio); }
INT32 APIENTRY ATMFontMan_CallBackValidateFont( ENUMLOGFONT FAR* lpelf, // address of logical-font data NEWTEXTMETRIC FAR* lpntm, // address of physical-font data INT32 FontType, // type of font LPARAM lParam // address of application-defined data ) { UNREFERENCED_PARAMETER (lpntm); if (FontType & DEVICE_FONTTYPE) { String_64 FontName(lpelf->elfLogFont.lfFaceName); FontManager* pFontMan = GetApplication()->GetFontManager(); pFontMan->ValidateItem(FC_ATM, &FontName, lpelf); } return TRUE; }
std::string PDFFontObject::ObjectEntry() { buffer += "<<\r"; buffer += "/Type /Font\r"; buffer += "/Subtype /Type1\r"; buffer += "/Name /"; buffer += FontName(); buffer += "\r/Encoding "; buffer += EncodingObjectStr(); buffer += " 0 R\r"; // buffer += "/BaseFont /MS Gothic\r"; buffer += "/BaseFont /"; buffer += actFontName;// "Times"; // buffer += "/BaseFont /Courier\r"; // buffer += "/BaseFont /Geneva\r"; if (actFontName == "Times") { if ( state & PDF_BOLD && state & PDF_ITALIC ) buffer += "-BoldItalic"; else if ( state & PDF_BOLD ) buffer += "-Bold"; else if ( state & PDF_ITALIC ) buffer += "-Italic"; else buffer += "-Roman"; } else if (actFontName == "Helvetica") { if ( state & PDF_BOLD && state & PDF_ITALIC ) buffer += "-BoldOblique"; else if ( state & PDF_BOLD ) buffer += "-Bold"; else if ( state & PDF_ITALIC ) buffer += "-Oblique"; } buffer += "\r"; // buffer += "/Leading 4\r"; buffer += ">>\r"; AddContents( buffer ); return PDFBodyObject::ObjectEntry(); }
INT32 APIENTRY ATMFontMan_CallBackCacheNamedFont( ENUMLOGFONT FAR* lpelf, // address of logical-font data NEWTEXTMETRIC FAR* lpntm, // address of physical-font data INT32 FontType, // type of font LPARAM lParam // address of application-defined data ) { UNREFERENCED_PARAMETER (lpntm); if (FontType & DEVICE_FONTTYPE) { String_64 FontName(lpelf->elfLogFont.lfFaceName); if (lParam==NULL || (_tcsncicmp(FontName, *((String_64 * )lParam), 64) == 0)) { FontManager* pFontMan = GetApplication()->GetFontManager(); pFontMan->SetTempFont(FC_ATM, &FontName, lpelf); return FALSE; } } return TRUE; }
void FontAttributes::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("FontAttributes"); if(searchNode == 0) return; DataNode *node; if((node = searchNode->GetNode("font")) != 0) { // Allow enums to be int or string in the config file if(node->GetNodeType() == INT_NODE) { int ival = node->AsInt(); if(ival >= 0 && ival < 3) SetFont(FontName(ival)); } else if(node->GetNodeType() == STRING_NODE) { FontName value; if(FontName_FromString(node->AsString(), value)) SetFont(value); } } if((node = searchNode->GetNode("scale")) != 0) SetScale(node->AsDouble()); if((node = searchNode->GetNode("useForegroundColor")) != 0) SetUseForegroundColor(node->AsBool()); if((node = searchNode->GetNode("color")) != 0) color.SetFromNode(node); if((node = searchNode->GetNode("bold")) != 0) SetBold(node->AsBool()); if((node = searchNode->GetNode("italic")) != 0) SetItalic(node->AsBool()); }
static void PDF_PrintWord(OBJECT x, int hpos, int vpos) { FULL_CHAR *p, *q, *a, *b, *lig, *unacc; int ksize; char *command; MAPPING m; unsigned short *composite; COMPOSITE *cmp; /* currently unused - JeffK */ static int last_hpos; /* does not need to be initialised */ static int next_hpos = -1; #if 0 struct metrics *fnt; #endif debug6(DPF, DD, "PrintWord( %s, %d, %d ) font %d colour %d%s", string(x), hpos, vpos, word_font(x), word_colour(x), word_outline(x) ? " outline" : ""); TotalWordCount++; /* if font is different to previous word then print change */ if( word_font(x) != currentfont ) { currentfont = word_font(x); currentxheight2 = FontHalfXHeight(currentfont); PDFFont_Set(out_fp, FontSize(currentfont, x), FontName(currentfont)); } /* if colour is different to previous word then print change */ if( word_colour(x) != currentcolour ) { currentcolour = word_colour(x); if( currentcolour > 0 ) { char str[256]; sprintf(str, "%s ", ColourCommand(currentcolour)); PDFPage_Write(out_fp, str); } } /* move to coordinate of x */ debug1(DPF, DDD, " currentxheight2 = %d", currentxheight2); vpos = vpos - currentxheight2; if( cpexists && (currenty == vpos) && PDFHasValidTextMatrix() ) { /* printnum(hpos, out_fp); */ command = "s"; /* Note: I calculate the width of the space char here in case the font has changed. This prevents subtle spacing errors. */ #if 0 fnt = finfo[currentfont].size_table; if( (next_hpos + fnt[' '].right /* width of space char */ ) == hpos ) command = " "; #endif } else { currenty = vpos; /* printnum(hpos, out_fp); fputs(" ", out_fp); printnum(currenty, out_fp); */ command = "m"; cpexists = TRUE; } /* convert ligature sequences into ligature characters */ lig = finfo[word_font(x)].lig_table; p = q = string(x); do { /* check for missing glyph (lig[] == 1) or ligatures (lig[] > 1) */ if( lig[*q++ = *p++] ) { if( lig[*(q-1)] == 1 ) continue; else { a = &lig[ lig[*(p-1)] + MAX_CHARS ]; while( *a++ == *(p-1) ) { b = p; while( *a == *b && *(a+1) != '\0' && *b != '\0' ) a++, b++; if( *(a+1) == '\0' ) { *(q-1) = *a; p = b; break; } else { while( *++a ); a++; } } } } } while( *p ); *q = '\0'; switch (command[0]) { case 'm': PDFText_OpenXY(out_fp, hpos, vpos); last_hpos = hpos; next_hpos = hpos + fwd(x, COLM); /* fwd(x, COLM) = width of wd */ break; case 's': #if 0 PDFText_Open(out_fp); PDFText_Kern(out_fp, hpos - next_hpos); #else PDFText_OpenX(out_fp, hpos - last_hpos); #endif last_hpos = hpos; next_hpos = hpos + fwd(x, COLM); /* fwd(x, COLM) = width of wd */ break; #if 0 case ' ': PDFText_Open(out_fp); #if 1 /* try kerning to get correct position */ PDFText_Kern(out_fp, fnt[' '].right); #else PDFPage_Write(out_fp, EightBitToPrintForm[' ']); #endif next_hpos += fwd(x, COLM) + fnt[' '].right; /* width of space ch */ break; #endif } p = string(x); PDFPage_Write(out_fp, EightBitToPrintForm[*p]); m = font_mapping(finfo[word_font(x)].font_table); unacc = MapTable[m]->map[MAP_UNACCENTED]; /* acc = MapTable[m]->map[MAP_ACCENT]; */ for( p++; *p; p++ ) { /* *** this seems right but is actually wrong for PDF, which according to Uwe uses original units for kerning KernLength(word_font(x), unacc, *(p-1), *p, ksize); *** */ KernLength(font_num(finfo[word_font(x)].original_face), unacc, *(p-1), *p, ksize); if ( ksize != 0 ) { PDFText_Kern(out_fp, ksize); } PDFPage_Write(out_fp, EightBitToPrintForm[*p]); } PDFText_Close(out_fp); debug0(DPF, DDD, "PDF_PrintWord returning"); } /* end PDF_PrintWord */
FontAttributes::FontName FontAttributes::GetFont() const { return FontName(font); }