private bool CollectFontInfo(Font ifont) { IntPtr font = IntPtr.Zero; if (UseRWops && CreateRWopsCacheOnFontRegister) { font = SDL_ttf.TTF_OpenFontIndexRW(ifont.RWops, 1, 16, ifont.index); } else { font = SDL_ttf.TTF_OpenFontIndex(ifont.filename, 16, ifont.index); } if (font.ShowSDLError("FontManager.CollectFontInfo(): Failed to load font!")) { return(false); } else { int fontfaces = (int)SDL_ttf.TTF_FontFaces(font); string fontface_familyname = SDL_ttf.TTF_FontFaceFamilyName(font); string fontface_stylename = SDL_ttf.TTF_FontFaceStyleName(font); bool fontface_mono = (SDL_ttf.TTF_FontFaceIsFixedWidth(font) > 0); int font_style = SDL_ttf.TTF_GetFontStyle(font); ifont.fontFamilyId = GetFontFamilyId(fontface_familyname, true); ifont.fontStyle = font_style; ifont.mono = fontface_mono; /* * Console.WriteLine(" Hash:{0}", _fonts[font_id].hash); * Console.WriteLine(" TTF_FontFaces: {0}", fontfaces); * Console.WriteLine(" TTF_FontFaceIsFixedWidth: {0}", fontface_mono); * * Console.WriteLine(" TTF_FontFaceFamilyName: {0}", fontface_familyname); * Console.WriteLine(" TTF_FontFaceStyleName: {0}", fontface_stylename); * Console.WriteLine(" TTF_GetFontStyle: {0}", font_style); */ if (ifont.index == 0 && fontfaces > 1) { for (int index = 1; index < fontfaces; index++) { //Console.WriteLine(" index: {0}", index); Font sub_ifont = ifont.Clone(); sub_ifont.index = index; if (CollectFontInfo(sub_ifont)) { _fonts.Add(sub_ifont); } } } SDL_ttf.TTF_CloseFont(font); return(true); } }
bool FillOutInfo() { _fontMetrics = new FontMetrics( SDL_ttf.TTF_FontHeight(_sdlFont), SDL_ttf.TTF_FontAscent(_sdlFont), SDL_ttf.TTF_FontDescent(_sdlFont), SDL_ttf.TTF_FontDescent(_sdlFont)); _style = SDL_ttf.TTF_GetFontStyle(_sdlFont); _outline = SDL_ttf.TTF_GetFontOutline(_sdlFont); _hinting = SDL_ttf.TTF_GetFontHinting(_sdlFont); _kerning = SDL_ttf.TTF_GetFontKerning(_sdlFont) != 0; return(true); }
public int GetStyle() { return(SDL_ttf.TTF_GetFontStyle(myPtr)); }