- Cached
- Glyph Designer 2 1 – Bitmap Font Generator Copy Software
- Glyph Designer 2 1 – Bitmap Font Generator Copy Paste
- See Full List On Angelcode.com
- 4A Games
Hinting with other algorithms (such as the TrueType one) will still be done if possible. Apparently some fonts look worse with the autohinter than without any hinting. This option is only available with FreeType 2.1.3 or newer. Don't load embedded bitmaps provided with scalable fonts. Bitmap fonts are still loaded normally. Advance: This field is an FTVector which holds the transformed advance value for the glyph. This is useful if you are using a transformation through FTSetTransform, as shown in the rotated text example of the previous part. See full list on pelulamu.net. Import SVG Fonts or outlines - Use your favorite vector editing program to create vector outlines, then import them to glyphs via SVG. Or open a whole SVG Font at once. Unicode-a-palooza - Easily select some common Unicode character ranges to design, or input arbitrary ranges - up to U+FFFF. That's 65k glyphs of excitement. Bitmap Font Editor PyPortal uses the CircuitPython Bitmap Font Library to render 'live' text on the display. This program can invoke Autotrace or Potrace for converting bitmaps to vector fonts. 14 Mojave as well, not on 10.
FreeType » Docs » Core API » Glyph Management
Synopsis¶
This section contains definitions used to manage glyph data through generic
FT_Glyph
objects. Each of them can contain a bitmap, a vector outline, or even images in other formats. These objects are detached from FT_Face
, contrary to FT_GlyphSlot
.FT_Glyph¶
Cached
Defined in FT_GLYPH_H (freetype/ftglyph.h).
Handle to an object used to model generic glyph images. It is a pointer to the
FT_GlyphRec
structure and can contain a glyph bitmap or pointer.note
Glyph objects are not owned by the library. You must thus release them manually (through
FT_Done_Glyph
) before calling FT_Done_FreeType
.FT_GlyphRec¶
Defined in FT_GLYPH_H (freetype/ftglyph.h).
The root glyph structure contains a given glyph image plus its advance width in 16.16 fixed-point format.
fields
library | A handle to the FreeType library object. |
clazz | A pointer to the glyph's class. Private. |
format | The format of the glyph's image. |
advance | A 16.16 vector that gives the glyph's advance width. |
FT_BitmapGlyph¶
Defined in FT_GLYPH_H (freetype/ftglyph.h).
A handle to an object used to model a bitmap glyph image. This is a sub-class of
FT_Glyph
, and a pointer to FT_BitmapGlyphRec
.FT_BitmapGlyphRec¶
Defined in FT_GLYPH_H (freetype/ftglyph.h).
A structure used for bitmap glyph images. This really is a ‘sub-class’ of
FT_GlyphRec
.fields
root | The root FT_Glyph fields. |
left | The left-side bearing, i.e., the horizontal distance from the current pen position to the left border of the glyph bitmap. |
top | The top-side bearing, i.e., the vertical distance from the current pen position to the top border of the glyph bitmap. This distance is positive for upwards y! |
bitmap | A descriptor for the bitmap. |
note
You can typecast an
FT_Glyph
to FT_BitmapGlyph
if you have glyph->format FT_GLYPH_FORMAT_BITMAP
. This lets you access the bitmap's contents easily.The corresponding pixel buffer is always owned by
FT_BitmapGlyph
and is thus created and destroyed with it.FT_OutlineGlyph¶
Defined in FT_GLYPH_H (freetype/ftglyph.h).
A handle to an object used to model an outline glyph image. This is a sub-class of
FT_Glyph
, and a pointer to FT_OutlineGlyphRec
.FT_OutlineGlyphRec¶
Defined in FT_GLYPH_H (freetype/ftglyph.h).
A structure used for outline (vectorial) glyph images. This really is a ‘sub-class’ of
FT_GlyphRec
.fields
root | The root FT_Glyph fields. |
outline | A descriptor for the outline. |
note
You can typecast an
FT_Glyph
to FT_OutlineGlyph
if you have glyph->format FT_GLYPH_FORMAT_OUTLINE
. This lets you access the outline's content easily.As the outline is extracted from a glyph slot, its coordinates are expressed normally in 26.6 pixels, unless the flag
FT_LOAD_NO_SCALE
was used in FT_Load_Glyph
or FT_Load_Char
.The outline's tables are always owned by the object and are destroyed with it.
FT_New_Glyph¶
Defined in FT_GLYPH_H (freetype/ftglyph.h).
A function used to create a new empty glyph image. Note that the created
FT_Glyph
object must be released with FT_Done_Glyph
.input
library | A handle to the FreeType library object. |
format | The format of the glyph's image. |
output
aglyph | A handle to the glyph object. |
return
FreeType error code. 0 means success.
since
2.10
FT_Get_Glyph¶
Defined in FT_GLYPH_H (freetype/ftglyph.h).
A function used to extract a glyph image from a slot. Note that the created
FT_Glyph
object must be released with FT_Done_Glyph
.input
slot | A handle to the source glyph slot. |
output
aglyph | A handle to the glyph object. |
return
FreeType error code. 0 means success.
note
Because
*aglyph->advance.x
and *aglyph->advance.y
are 16.16 fixed-point numbers, slot->advance.x
and slot->advance.y
(which are in 26.6 fixed-point format) must be in the range ]-32768;32768[.FT_Glyph_Copy¶
Defined in FT_GLYPH_H (freetype/ftglyph.h).
A function used to copy a glyph image. Note that the created
FT_Glyph
object must be released with FT_Done_Glyph
.input
source | A handle to the source glyph object. |
output
target | A handle to the target glyph object. 0 in case of error. |
return
FreeType error code. 0 means success.
FT_Glyph_Transform¶
Glyph Designer 2 1 – Bitmap Font Generator Copy Software
Defined in FT_GLYPH_H (freetype/ftglyph.h).
Transform a glyph image if its format is scalable.
inout
glyph | A handle to the target glyph object. |
input
matrix | A pointer to a 2x2 matrix to apply. |
delta | A pointer to a 2d vector to apply. Coordinates are expressed in 1/64th of a pixel. |
return
FreeType error code (if not 0, the glyph format is not scalable).
note
The 2x2 transformation matrix is also applied to the glyph's advance vector.
FT_Glyph_BBox_Mode¶
Defined in FT_GLYPH_H (freetype/ftglyph.h).
The mode how the values of
FT_Glyph_Get_CBox
are returned.values
FT_GLYPH_BBOX_UNSCALED | Return unscaled font units. |
FT_GLYPH_BBOX_SUBPIXELS | Return unfitted 26.6 coordinates. |
FT_GLYPH_BBOX_GRIDFIT | Return grid-fitted 26.6 coordinates. |
FT_GLYPH_BBOX_TRUNCATE | Return coordinates in integer pixels. |
FT_GLYPH_BBOX_PIXELS | Return grid-fitted pixel coordinates. |
FT_Glyph_Get_CBox¶
Defined in FT_GLYPH_H (freetype/ftglyph.h).
Return a glyph's ‘control box’. The control box encloses all the outline's points, including Bezier control points. Though it coincides with the exact bounding box for most glyphs, it can be slightly larger in some situations (like when rotating an outline that contains Bezier outside arcs).
Computing the control box is very fast, while getting the bounding box can take much more time as it needs to walk over all segments and arcs in the outline. To get the latter, you can use the ‘ftbbox’ component, which is dedicated to this single task.
input
glyph | A handle to the source glyph object. |
mode | The mode that indicates how to interpret the returned bounding box values. |
output
acbox | The glyph coordinate bounding box. Coordinates are expressed in 1/64th of pixels if it is grid-fitted. |
note
Coordinates are relative to the glyph origin, using the y upwards convention.
If the glyph has been loaded with
FT_LOAD_NO_SCALE
, bbox_mode
must be set to FT_GLYPH_BBOX_UNSCALED
to get unscaled font units in 26.6 pixel format. The value FT_GLYPH_BBOX_SUBPIXELS
is another name for this constant.If the font is tricky and the glyph has been loaded with
FT_LOAD_NO_SCALE
, the resulting CBox is meaningless. To get reasonable values for the CBox it is necessary to load the glyph at a large ppem value (so that the hinting instructions can properly shift and scale the subglyphs), then extracting the CBox, which can be eventually converted back to font units.Note that the maximum coordinates are exclusive, which means that one can compute the width and height of the glyph image (be it in integer or 26.6 pixels) as:
Note also that for 26.6 coordinates, if
bbox_mode
is set to FT_GLYPH_BBOX_GRIDFIT
, the coordinates will also be grid-fitted, which corresponds to:To get the bbox in pixel coordinates, set
bbox_mode
to FT_GLYPH_BBOX_TRUNCATE
.To get the bbox in grid-fitted pixel coordinates, set
bbox_mode
to FT_GLYPH_BBOX_PIXELS
.FT_Glyph_To_Bitmap¶
Defined in FT_GLYPH_H (freetype/ftglyph.h).
Convert a given glyph object to a bitmap glyph object.
inout
the_glyph | A pointer to a handle to the target glyph. |
input
render_mode | An enumeration that describes how the data is rendered. |
origin | A pointer to a vector used to translate the glyph image before rendering. Can be 0 (if no translation). The origin is expressed in 26.6 pixels. |
destroy | A boolean that indicates that the original glyph image should be destroyed by this function. It is never destroyed in case of error. |
return
FreeType error code. 0 means success.
note
This function does nothing if the glyph format isn't scalable.
The glyph image is translated with the
origin
vector before rendering.The first parameter is a pointer to an
FT_Glyph
handle, that will be replaced by this function (with newly allocated data). Typically, you would use (omitting error handling):Here is another example, again without error handling:
FT_Done_Glyph¶
Defined in FT_GLYPH_H (freetype/ftglyph.h).
Destroy a given glyph.
input
glyph | A handle to the target glyph object. |
Glyph Designer 2 1 – Bitmap Font Generator Copy Paste
Posted: 17 Mar 2015 at 00:08 by CodeheadOne of the big problems OpenGL runs into after you’ve got your first few polygons flying around the screen is the lack of a standard method for generating text within the API.
A few techniques have evolved to tackle the problem:
Pre-generated string textures
The simplest and fastest method, a texture is pre-built for each piece of text that needs to be displayed. This is quick to render at run time, but isn’t very flexible or efficient.
Polygon glyphs created from outline font definitions
This method produces high quality, scalable text, but this is also the slowest approach due to the overhead of generating and rendering the glyph polygons.
WGL and GLUT extensions
These extensions do a great job of text rendering. However, these libraries are not universally available on all systems and I have a bad habit of trying to be portable and platform independent.
Bitmapped fonts
Bitmap fonts are fast, flexible and platform independent. However, there are some limitations: Quality suffers when scaling up the texture and the number of possible characters in a font bitmap is limited. Extended or Unicode character sets with accents or non-latin symbols are not well supported.
A bitmapped font is simply an atlas texture containing a collection of glyphs and symbols. (Note: the purple lines are a visual aid, they do not appear on the actual texture.)
The coma 2: vicious sisters wiki. The grid layout means that the calculation required to select any given character is quick and simple.
The area containing the selected characters can then be mapped onto a series of polygons to create dynamic strings of text.
Adding width information to the glyphs allows the textured quads to be overlapped to create better looking text with variable character widths.
There are quite a few bitmap font generators around, but I couldn’t find one that provided all the features I wanted. So I wrote my own.
Codehead’s Bitmap Font Generator (CBFG) is now at version 1.45 and supports the following features:
- DIB rendering of font gives best font output, regardless of users screen settings
- Global or per character position and width adjustment
- Texture Sizes from 16×16 up to 4096×4096
- Zoom up to 400% for accurate tweaking of character positions
- Anti-aliasing or ClearType (XP+) for smoother looking fonts
- Control of font width
- Font preview option
- TGA export option
- BMP output option
- BFF output in 8, 24 and 32bit colour depths
- C++ example source code for loading and rendering BFF files
- Binary font data export
- Font info dump option
- User configurable colours and startup parameters
Many people have made useful suggestions that have been implemented in CBFG, and the tool has been used on the following projects:
- Floating Sandbox A 2D Physics Simulator developed by Gabriele Giuseppini.
- Beginning Android Games An APress book by Robert Green and Mario Zechner
- SkaPong by Einar
- SF2DBmpFont a font loader for 3DS homebrew by Flarn2006
- ByVac’s [BV4629] Touchscreen LCD
Downloads
CBFG Packages
Windows Installer Package
Files only zip
Source Code
CBFG has been open sourced under the BSD licence. You can get v1.45 on GitHub
BFF Loading Code
See Full List On Angelcode.com
C/C++ - included in zip/installer.
Android by Codehead
O’Caml by Einar (local mirror)
SF2DBmpFont a font loader for SF2DLib by Flarn2006
The Future
CBFG hasn’t been in active development for a few years now, but there are still a few features I always wanted to add:
ToDo List
- State save option
- Merge/Extract font image
Wish List
4A Games
- Export in other font generator formats
- Edit font image
- Unicode support
Known Issues
Cleartype system setting can override antialias settings in application.
Please enable JavaScript to view the comments powered by Disqus.