I am building support for Freetype (2.10.1) in my application and I just came across my first serious problem. I opened a font called bahnschrift.ttf that was available in my Windows fonts folder and it seems to support several different styles in a single file. However, Freetype reports only a single face available.
How can I create separate faces for the different font styles in this case? Does Freetype support variable fonts?
Thanks.
FreeType supports variable fonts since version 2.8.
You probably got to the point of instantiating an FT_Face with FreeType. From there, most of the documentation related to OpenType font variations is in the Multiple Masters section of the documentation:
https://www.freetype.org/freetype2/docs/reference/ft2-multiple_masters.html
To find out which variable axes a font has, you can use:
FT_Get_MM_Var on your FT_Face which contains the named styles in FT_MM_Var structures.
To then set variable font design coordinates, use FT_Set_Var_Design_Coordinates or FT_Set_Named_Instance to select a specific named instance.
Related
I want to add an Unicode Symbol as a list widget item in QT. (Particularly this item : http://www.fileformat.info/info/unicode/char/25B6/index.htm )
I'm using following method for this :
this->addItem( new QListWidgetItem( QString::fromUtf8("\u25B6")) ) ;
But when I open the widget I see only a blank rectangle in place of this unicode symbol. I even tried other unicode symbols too, but they too are showing only blank rectangle.
What's wrong in this method?
EDIT: After following the answer, I changed the font of QListWidgetItem to Serif and it worked.
There are several possibilities, but the most probable one is that the font you are using doesn't implement the glyph at all. Can you see the triangle in eg. an editor when using the same font as your Qt font?
Edit: The fonts (which are stored in the system's font files) are the commands to draw the images of each character on the screen). Many (if not all) fonts are incomplete, which means they are not able to represent all 2,000,000,000+ codes which are possible in the unicode (the numbers which represent the characters). The files would just be to large to be practical.
The triangles you want printed are fairly basic, and should be available in many font sets. Liberation Sans and Liberation Serif are two I just checked.
I suspect Qt uses the font set of the system, which can probably be changed in the System Settings somewhere. If you tell us which distribution you are using (i.e. Ubuntu, Debian, ...), maybe we can help.
I'd like to have some text in my OpenGL application. However, I'm using 3.1+, and all articles I found on the Internet use deprecated features, like display lists or glBitmap or (the worst case) GLUT.
What should I use on Win32 then? (except pre-written text in pre-made textures, of course)
Freetype is a software font engine that supports SFNT-based bitmap fonts.
I am trying to use glutStrokeString using freeglut.
The program runs fine up to the point it has to call glutStrokeString, then it outputs the console freeglut stroke font not found.
Any idea why?
GLUT_BITMAP_HELVETICA_18, as the name suggests, is a bitmap font. You can't use them with the Stroke rendering commands. So if you want to use that font, you have to use glutBitmapString.
FreeGLUT comes with two stroke fonts: GLUT_STROKE_ROMAN and GLUT_STROKE_MONO_ROMAN. So if you want to use the stroke commands to render the fonts, you have to use one of those kinds of fonts.
Just check out the file, gluit/freeglut_font.c, in your glut source code, contains everything you need to know, Also check fghFontByID() and fghStrokeByID() which are actually used to computed the font id for both the functions that is glutBitmapString() & glutStrokeString()
or check out this
I'm rendering some text using pangomm, but the font that I am using doesn't have glyphs for parts of the text (in this case, there is some Japanese mixed in with English). Pango seems to render the text correctly using a fallback font.
How can I determine which font is being used as the fallback?
Actually the font selection is based on the selected Pango font backend. Mostly used (I think) is Fontconfig.
You fonts are basically always chosen by looking at the fonts Unicode coverage, meaning that Fontconfig tries to choose the font that covers the letters in the text you want to render best.
Not knowing if your problem applies to Fontconfig, I won't go into to much detail. But if so, have a look at http://www.freedesktop.org/software/fontconfig/fontconfig-user.html, especially the section on 'font matching'.
Feel free to ask again.
When setting a font in a Qt application, where can I find the list of fonts I can choose from?
Thanks.
You can use the QFontDatabase class to get information about available fonts in the underlying window system.