void SettingsWindow::SaveValues() { auto appSettings(GetAppSettings().lock()); assert(appSettings); GetDieFace(); appSettings->DeathThreshold ( GetValue ( f_table, DeathThreshold ) ); appSettings->CombatantListFont ( GetFontName( f_table, CharListFont ) ); appSettings->AltCombatantListFont( GetFontName( f_table, AltCharListFont ) ); Gtk::TreeModel::iterator iter = f_model->children().begin(); const Gtk::TreeModel::iterator end = f_model->children().end(); // for( ; iter != end; ++iter ) { Gtk::TreeModel::Row row = *iter; const mo_name_t id = row[f_columns.f_id]; const bool active = row[f_columns.f_active]; if( id == (mo_name_t) moName(UltraInit) ) { appSettings->UltraInit( active ); } if( id == (mo_name_t) moName(BleedOut) ) { appSettings->BleedOutDying( active ); } if( id == (mo_name_t) moName(SkipDead) ) { appSettings->SkipDead( active ); } if( id == (mo_name_t) moName(AltDeathRule)) { appSettings->AlternateDeathRule( active ); } if( id == (mo_name_t) moName(NotifyExpiredEffects)) { appSettings->NotifyExpiredEffects( active );} if( id == (mo_name_t) moName(InitOnStart) ) { appSettings->InitOnStart( active ); } if( id == (mo_name_t) moName(ManualInit) ) { appSettings->ManualInit( active ); } if( id == (mo_name_t) moName(GetDC) ) { appSettings->GetDC( active ); } } appSettings->signal_changed().emit(); }
// Set the current font size bool Font::SetCurrentSize( unsigned int size ) { unsigned int currentSize = GetCurrentSize(); // Only change the size if necessary if ( currentSize != size ) { FT_Error error = FT_Set_Pixel_Sizes( _myFontFace, 0, size ); #if defined( _DEBUG ) || defined( DEBUG ) // If the given size was invalid, print out valid sizes if ( error == FT_Err_Invalid_Pixel_Size && !FT_IS_SCALABLE( _myFontFace ) ) { std::cout << "Failed to set " << GetFontName() << " font size to " << size << std::endl; std::cout << "Valid sizes for " << GetFontName() << ":" << std::endl; for ( int i = 0; i < _myFontFace->num_fixed_sizes; ++i ) { std::cout << " " << _myFontFace->available_sizes[ i ].height << std::endl; } } #endif return error == FT_Err_Ok; } return true; }
void CRRECToolBar::OnSelchangeFont() { CString font = GetFontName(); if (!font.IsEmpty()) GetParent()->SendMessage( urm_SETCURRENTFONTNAME, ( WPARAM ) ( LPCTSTR ) font, 0 ); }
// Initialize the font bool UIWidget::InitializeFont(void) { if(m_pUILabelBMFont) return true; // Tricky note: // Save the position and apply it for m_pUILabelBMFont // because once m_pUILabelBMFont is initialized, the position // will be returned by m_pUILabelBMFont->GetPosition(), // not GTGameObject::GetPosition(). GTPoint2 position = GetPosition(); m_pUILabelBMFont = GameObjectCreation::CreateUILabelBMFont(); if(m_pUILabelBMFont) { // Initialize the font m_pUILabelBMFont->Initialize(GetFontName(), GetZOrder()); // Set text m_pUILabelBMFont->SetText(GetText()); // Set position m_pUILabelBMFont->SetPosition(position); // Set visible m_pUILabelBMFont->SetVisible(UIWidget::GetVisible()); // Set ZOrder m_pUILabelBMFont->SetZOrder(UIWidget::GetZOrder()); return true; } return false; }
CFont* InformApp::GetFont(Fonts font) { CFont& theFont = m_fonts[font]; if ((HFONT)theFont == 0) theFont.CreatePointFont(10*GetFontSize(font),GetFontName(font)); return &theFont; }
//////////////////////////////////////////////////////////////////// // Public functions // void CDrawField::Draw( int page, CDC* dc ) /* ============================================================ Function : CDrawField::Draw Description : Draws this object. Access : Public Return : void Parameters : int page - Current page CDC* dc - CDC to draw to Usage : Called by the generator to draw the object. ============================================================*/ { CString title = GetTitle(); CDoubleRect rect = GetPosition(); CUnitConversion::InchesToPixels( rect ); CRect r( static_cast< int >( rect.left ), static_cast< int >( rect.top ), static_cast< int >( rect.right ), static_cast< int >( rect.bottom ) ); CUnitConversion::AdjustPixelsToPaper( dc, r ); LOGFONT lf; ZeroMemory( &lf, sizeof( lf ) ); lstrcpy( lf.lfFaceName, GetFontName() ); lf.lfHeight = CUnitConversion::PointsToPixels( static_cast< double >( GetFontSize() ) / 10.0 ); lf.lfItalic = static_cast< BYTE >( GetFontItalic() ); lf.lfUnderline = static_cast< BYTE >( GetFontUnderline() ); lf.lfStrikeOut = static_cast< BYTE >( GetFontStrikeout() ); lf.lfCharSet = static_cast< BYTE >( GetFontCharset() ); if( GetFontBold() ) lf.lfWeight = FW_BOLD; else lf.lfWeight = FW_NORMAL; if( IsBold( title ) ) lf.lfWeight = FW_BOLD; if( IsItalic( title ) ) lf.lfItalic = TRUE; CFont font; font.CreateFontIndirect( &lf ); dc->SelectObject( &font ); int color = dc->SetTextColor( GetFontColor() ); int mode = dc->SetBkMode( TRANSPARENT ); int justification = GetJustification(); ReplaceFields( page, title ); dc->DrawText( title, r, DT_NOPREFIX | DT_WORDBREAK | justification ); dc->SetBkMode( mode ); dc->SetTextColor( color ); dc->SelectStockObject( ANSI_VAR_FONT ); }
// we don't use CreateFormatterArgsDoc() to not introduce dependency // on gGlobalPrefs in EngineDump HtmlFormatterArgs *CreateFormatterArgsDoc2(Doc doc, int dx, int dy, PoolAllocator *textAllocator) { HtmlFormatterArgs *args = CreateFormatterArgsDoc(doc, dx, dy, textAllocator); args->SetFontName(GetFontName()); args->fontSize = GetFontSize(); return args; }
HtmlFormatterArgs *CreateFormatterArgsDoc(Doc doc, int dx, int dy, Allocator *textAllocator) { HtmlFormatterArgs *args = CreateFormatterDefaultArgs(dx, dy, textAllocator); args->htmlStr = doc.GetHtmlData(args->htmlStrLen); args->SetFontName(GetFontName()); args->fontSize = GetFontSize(); return args; }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CDemoActionTextMessageStart::FireAction( void ) { GetTextMessage()->pVGuiSchemeFontName = GetFontName(); TextMessage_DemoMessageFull( GetMessageText(), GetTextMessage() ); CL_HudMessage( (const char *)DEMO_MESSAGE ); SetFinishedAction( true ); }
static void GenerateFont(void) { if(!_bInitialized) return; try { _iiFont.Clear(); _iiGrid.Clear(); _iiFont.ii_Width = GetIntFromControl(ICB_TEX_WIDTH); _iiFont.ii_Height = GetIntFromControl(ICB_TEX_HEIGHT); _iiFont.ii_BitsPerPixel = 32; _iiGrid.ii_Width = _iiFont.ii_Width; _iiGrid.ii_Height = _iiFont.ii_Height; _iiGrid.ii_BitsPerPixel = _iiFont.ii_BitsPerPixel; SLONG slSize = _iiFont.ii_Width*_iiFont.ii_Height * _iiFont.ii_BitsPerPixel/8; _iiFont.ii_Picture = (UBYTE*)AllocMemory(slSize); _iiGrid.ii_Picture = (UBYTE*)AllocMemory(slSize); memset(_iiFont.ii_Picture,0,slSize); memset(_iiGrid.ii_Picture,0,slSize); CTString strFontName = GetFontName(); if(strFontName.Length() == 0) { throw("No font selected"); } ULONG ulFlags = GetFontFlags(); INDEX iFontSize = GetIntFromControl(IEC_FONT_SIZE); INDEX iFirstChar = GetIntFromControl(IEC_FIRST_CHAR); INDEX iLastChar = GetIntFromControl(IEC_LAST_CHAR); INDEX iAlignH = GetComboIndex(IDC_ALIGN_H); INDEX iAlignV = GetComboIndex(IDC_ALIGN_V); INDEX iPaddingX = GetIntFromControl(IEC_PADDINGX); INDEX iPaddingY = GetIntFromControl(IEC_PADDINGY); INDEX iWidthAdd = GetIntFromControl(IEC_WIDTH_ADD); INDEX iHeightAdd = GetIntFromControl(IEC_HEIGHT_ADD); INDEX ctShadows = GetIntFromControl(IEC_SHADOW_PASSES); if(ulFlags&FNT_HAS_SHADOW) { iPaddingX+=ctShadows; iPaddingY+=ctShadows; iWidthAdd+=ctShadows; iHeightAdd+=ctShadows; } _pfdCurrentFont = NULL; GenerateFont_t(_fdFont,_iiFont,_iiGrid,strFontName,iFontSize,iLastChar,iFirstChar,iAlignH,iAlignV,iPaddingX,iPaddingY,iWidthAdd,iHeightAdd,ulFlags,ctShadows); _pfdCurrentFont = &_fdFont; RefreshCanvas(); } catch (char *strErr) { MessageBox(_hWnd,strErr,0,0); } }
/* Given a file in a font, find all of the files for the font. * * Possibilities: * * Normal 16x16.png * Normal [other] 16x16.png * Normal [more] 8x8.png * Normal 16x16.ini * Normal.ini * * Any of the above should find all of the above. Allow the * extension to be omitted. */ void Font::GetFontPaths( const CString &sFontOrTextureFilePath, CStringArray &asTexturePathsOut, CString &sIniPath ) { CString sDir, sFName, sExt; splitpath( sFontOrTextureFilePath, sDir, sFName, sExt ); /* Don't give us a redir; resolve those before sending them here. */ ASSERT( sExt.CompareNoCase("redir") ); /* sFName can't be empty, or we don't know what to search for. */ ASSERT( !sFName.empty() ); CString sFontName = GetFontName( sFName ); CStringArray asFiles; GetDirListing( sDir+sFontName + "*", asFiles, false, false ); for( unsigned i = 0; i < asFiles.size(); ++i ) { /* We now have a list of possibilities, but it may include false positives, * such as "Normal2" when the font name is "Normal". Weed them. */ if( GetFontName(asFiles[i]).CompareNoCase(sFontName) ) continue; /* If it's an INI, and we don't already have an INI, use it. */ if( !asFiles[i].Right(4).CompareNoCase(".ini")) { if( !sIniPath.empty() ) RageException::Throw( "More than one INI found\n%s\n%s", sIniPath.c_str(), asFiles[i].c_str() ); sIniPath = sDir+asFiles[i]; continue; } asTexturePathsOut.push_back( sDir+asFiles[i] ); } }
HFONT AFXAPI _AfxGetHelpFont() { LONG nFondAndSize; LOGFONT logfont; nFondAndSize = GetScriptVariable(smSystemScript, smScriptHelpFondSize); memset(&logfont, 0, sizeof(logfont)); logfont.lfWeight = FW_NORMAL; logfont.lfPitchAndFamily = VARIABLE_PITCH | FF_SWISS; logfont.lfHeight = -MulDiv(LOWORD(nFondAndSize), afxData.cyPixelsPerInch, 72); GetFontName(HIWORD(nFondAndSize), (StringPtr) logfont.lfFaceName); p2cstr((StringPtr) logfont.lfFaceName); return ::CreateFontIndirect(&logfont); }
static PyObject *Fm_GetFontName(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; short familyID; Str255 name; #ifndef GetFontName PyMac_PRECHECK(GetFontName); #endif if (!PyArg_ParseTuple(_args, "h", &familyID)) return NULL; GetFontName(familyID, name); _res = Py_BuildValue("O&", PyMac_BuildStr255, name); return _res; }
void PDFWriter::GetFontName(BFont *font, char *fontname, bool &embed, font_encoding encoding) { GetFontName(font, fontname); switch (encoding) { case japanese_encoding: strcpy(fontname, "HeiseiMin-W3"); return; case chinese_cns1_encoding: strcpy(fontname, "MHei-Medium"); return; case chinese_gb1_encoding: strcpy(fontname, "STSong-Light"); return; case korean_encoding: strcpy(fontname, "HYGoThic-Medium"); return; default:; } }
char *MCScreenDC::charsettofontname(uint1 charset, const char *oldfontname) { char *fname = new char[255]; strcpy(fname, oldfontname); char *sptr = fname; if ((sptr = strchr(fname, ',')) != NULL) *sptr = '\0'; char *tmpname = strclone(fname);//make a copy of the font name short ffamilyid; //font family ID StringPtr reqnamePascal = c2pstr(tmpname); GetFNum(reqnamePascal, &ffamilyid); delete tmpname; if (FontToScript(ffamilyid) != MCS_charsettolangid(charset)) { GetFontName(GetScriptVariable(MCS_charsettolangid(charset), smScriptAppFond), (unsigned char *)fname); p2cstr((unsigned char *)fname); } return fname; }
//----------------------------------------------------------------------------- // Purpose: // Input : buf - //----------------------------------------------------------------------------- void CDemoActionTextMessageStart::SaveKeysToBuffer( int depth, CUtlBuffer& buf ) { BaseClass::SaveKeysToBuffer( depth, buf ); client_textmessage_t const *tm = GetTextMessage(); int fadeinout = tm->effect == 0 ? 1 : 0; int fadeinoutflicker = tm->effect == 1 ? 1 : 0; int fadewriteout = tm->effect == 2 ? 1 : 0; BufPrintf( depth, buf, "message \"%s\"\n", GetMessageText() ); BufPrintf( depth, buf, "font \"%s\"\n", GetFontName() ); BufPrintf( depth, buf, "fadein \"%.3f\"\n", tm->fadein ); BufPrintf( depth, buf, "fadeout \"%.3f\"\n", tm->fadeout ); BufPrintf( depth, buf, "holdtime \"%.3f\"\n", tm->holdtime ); BufPrintf( depth, buf, "fxtime \"%.3f\"\n", tm->fxtime ); if ( fadeinout > 0 ) BufPrintf( depth, buf, "FADEINOUT \"1\"\n" ); if ( fadeinoutflicker > 0 ) BufPrintf( depth, buf, "FLICKER \"1\"\n" ); if ( fadewriteout > 0 ) BufPrintf( depth, buf, "WRITEOUT \"1\"\n" ); BufPrintf( depth, buf, "x \"%f\"\n", tm->x ); BufPrintf( depth, buf, "y \"%f\"\n", tm->y ); BufPrintf( depth, buf, "r1 \"%i\"\n", tm->r1 ); BufPrintf( depth, buf, "g1 \"%i\"\n", tm->g1 ); BufPrintf( depth, buf, "b1 \"%i\"\n", tm->b1 ); BufPrintf( depth, buf, "a1 \"%i\"\n", tm->a1 ); BufPrintf( depth, buf, "r2 \"%i\"\n", tm->r2 ); BufPrintf( depth, buf, "g2 \"%i\"\n", tm->g2 ); BufPrintf( depth, buf, "b2 \"%i\"\n", tm->b2 ); BufPrintf( depth, buf, "a2 \"%i\"\n", tm->a2 ); }
void getfontname(short familyID, char *theName) { GetFontName(familyID,(StringPtr)theName); my_p2cstr(theName); }
void PDFWriter::DrawChar(uint16 unicode, const char* utf8, int16 size) { // try to convert from utf8 to MacRoman encoding schema... int32 srcLen = size; int32 destLen = 1; char dest[3] = "\0\0"; int32 state = 0; bool embed = true; font_encoding encoding = macroman_encoding; char fontName[B_FONT_FAMILY_LENGTH+B_FONT_STYLE_LENGTH+1]; if (convert_from_utf8(B_MAC_ROMAN_CONVERSION, utf8, &srcLen, dest, &destLen, &state, 0) != B_OK || dest[0] == 0) { // could not convert to MacRoman font_encoding fenc; uint16 index = 0; uint8 enc; GetFontName(&fState->beFont, fontName); embed = EmbedFont(fontName); REPORT(kDebug, -1, "find_encoding unicode %d\n", (int)unicode); if (find_encoding(unicode, enc, index)) { // is code point in the Adobe Glyph List? // Note if rendering the glyphs only would be desired, we could // always use the second method below (MakeUserDefinedEncoding), // but extracting text from the generated PDF would be almost // impossible (OCR!) REPORT(kDebug, -1, "encoding for %x -> %d %d", unicode, (int)enc, (int)index); // use one of the user pre-defined encodings if (fState->beFont.FileFormat() == B_TRUETYPE_WINDOWS) { encoding = font_encoding(enc + tt_encoding0); } else { encoding = font_encoding(enc + t1_encoding0); } *dest = index; } else if (embed) { // if the font is embedded, create a user defined encoding at runtime uint8 index; MakeUserDefinedEncoding(unicode, enc, index); *dest = index; encoding = font_encoding(user_defined_encoding_start + enc); } else if (find_in_cid_tables(unicode, fenc, index, fFontSearchOrder)) { // font is not embedded use one of the CJK fonts for substitution REPORT(kDebug, -1, "cid table %d index = %d", (int)fenc, (int)index); dest[0] = unicode / 256; dest[1] = unicode % 256; destLen = 2; encoding = fenc; embed = false; } else { static bool found = false; REPORT(kDebug, -1, "encoding for %x not found!", (int)unicode); if (!found) { found = true; REPORT(kError, fPage, "Could not find an encoding for character " "with unicode %d! Message is not repeated for other unicode " "values.", (int)unicode); } *dest = 0; // paint a box (is 0 a box in MacRoman) or return; // simply skip character } } else { REPORT(kDebug, -1, "macroman srcLen=%d destLen=%d dest= %d %d!", srcLen, destLen, (int)dest[0], (int)dest[1]); } // Note we have to build the user defined encoding before it is used in // PDF_find_font! if (!MakesPDF()) return; int font; GetFontName(&fState->beFont, fontName, embed, encoding); font = FindFont(fontName, embed, encoding); if (font < 0) { REPORT(kWarning, fPage, "**** PDF_findfont(%s) failed, back to default " "font", fontName); font = PDF_findfont(fPdf, "Helvetica", "macroman", 0); } fState->font = font; uint16 face = fState->beFont.Face(); PDF_set_parameter(fPdf, "underline", (face & B_UNDERSCORE_FACE) != 0 ? "true" : "false"); PDF_set_parameter(fPdf, "strikeout", (face & B_STRIKEOUT_FACE) != 0 ? "true" : "false"); PDF_set_value(fPdf, "textrendering", (face & B_OUTLINED_FACE) != 0 ? 1 : 0); PDF_setfont(fPdf, fState->font, scale(fState->beFont.Size())); const float x = tx(fState->penX); const float y = ty(fState->penY); const float rotation = fState->beFont.Rotation(); const bool rotate = rotation != 0.0; if (rotate) { PDF_save(fPdf); PDF_translate(fPdf, x, y); PDF_rotate(fPdf, rotation); PDF_set_text_pos(fPdf, 0, 0); } else PDF_set_text_pos(fPdf, x, y); PDF_show2(fPdf, dest, destLen); if (rotate) { PDF_restore(fPdf); } }
OSStatus FMGetFontFamilyName(FMFontFamily fontFamilyID, Str255 fontNameStr) { GetFontName(fontFamilyID, fontNameStr); return noErr; }
bool wxListBox::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, int n, const wxString choices[], long style, const wxValidator& validator, const wxString& name) { if ( !wxListBoxBase::Create(parent, id, pos, size, style & ~(wxHSCROLL|wxVSCROLL), validator, name) ) return false; m_noItems = 0 ; // this will be increased by our append command m_selected = 0; Rect bounds ; Str255 title ; MacPreControlCreate( parent , id , wxEmptyString , pos , size ,style, validator , name , &bounds , title ) ; ListDefSpec listDef; listDef.defType = kListDefUserProcType; if ( macListDefUPP == NULL ) { macListDefUPP = NewListDefUPP( wxMacListDefinition ); } listDef.u.userProc = macListDefUPP ; Str255 fontName ; SInt16 fontSize ; Style fontStyle ; #if TARGET_CARBON GetThemeFont(kThemeViewsFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ; #else GetFontName( kFontIDMonaco , fontName ) ; fontSize = 9 ; fontStyle = normal ; #endif SetFont( wxFont (fontSize, wxSWISS, wxNORMAL, wxNORMAL , false , wxMacMakeStringFromPascal( fontName ) ) ) ; #if TARGET_CARBON Size asize; CreateListBoxControl( MAC_WXHWND(parent->MacGetRootWindow()), &bounds, false, 0, 1, (style & wxLB_HSCROLL), true, kwxMacListItemHeight, kwxMacListItemHeight, false, &listDef, (ControlRef *)&m_macControl ); GetControlData( (ControlHandle) m_macControl, kControlNoPart, kControlListBoxListHandleTag, sizeof(ListHandle), (Ptr) &m_macList, &asize); SetControlReference( (ControlHandle) m_macControl, (long) this); SetControlVisibility( (ControlHandle) m_macControl, false, false); #else long result ; wxStAppResource resload ; m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , (style & wxLB_HSCROLL) ? kwxMacListWithVerticalAndHorizontalScrollbar : kwxMacListWithVerticalScrollbar , 0 , 0, kControlListBoxProc , (long) this ) ; ::GetControlData( (ControlHandle) m_macControl , kControlNoPart , kControlListBoxListHandleTag , sizeof( ListHandle ) , (char*) &m_macList , &result ) ; HLock( (Handle) m_macList ) ; ldefHandle ldef ; ldef = (ldefHandle) NewHandle( sizeof(ldefRec) ) ; if ( (**(ListHandle)m_macList).listDefProc != NULL ) { (**ldef).instruction = 0x4EF9; /* JMP instruction */ (**ldef).function = (void(*)()) listDef.u.userProc; (**(ListHandle)m_macList).listDefProc = (Handle) ldef ; } Point pt = (**(ListHandle)m_macList).cellSize ; pt.v = kwxMacListItemHeight ; LCellSize( pt , (ListHandle)m_macList ) ; LAddColumn( 1 , 0 , (ListHandle)m_macList ) ; #endif OptionBits options = 0; if ( style & wxLB_MULTIPLE ) { options += lExtendDrag + lUseSense ; } else if ( style & wxLB_EXTENDED ) { // default behaviour } else { options = (OptionBits) lOnlyOne ; } SetListSelectionFlags((ListHandle)m_macList, options); for ( int i = 0 ; i < n ; i++ ) { Append( choices[i] ) ; } MacPostControlCreate() ; LSetDrawingMode( true , (ListHandle)m_macList ) ; return true; }