Possible Wording Error on FreeType Tutorial 1 Page
Gary Townsend <[email protected]> Wed, 14 Sep 2022 15:33:07 +0000
| Newsgroups | gmane.comp.fonts.freetype.user |
|---|---|
| Message-ID | <LO4P123MB6516CFC941884B103512A42CB8469@LO4P123MB6516.GBRP123.PROD.OUTLOOK.COM> |
Hi There,
Please refer to your following page: FreeType Tutorial / I<https://freetype.org/freetype2/docs/tutorial/step1.html>
Please confirm/explain if the part that I’ve highlighted in Red below, is in error?
I mean... please kindly explain what it’s trying to say? “expressed in 1/64th of a pixel”, but then specifically... for “a character size of 12 points”? What about point sizes other than 12? (Sorry if I’m missing something, but that has me quite confused 😊)
Thank you in advance, cheers, Gary.
FreeType 2 uses size objects to model all information related to a given character size for a given face. For example, a size object holds the value of certain metrics like the ascender or text height, expressed in 1/64th of a pixel, for a character size of 12 points (however, those values are rounded to integers, i.e., multiples of 64).
When the FT_New_Face function is called (or one of its siblings), it automatically creates a new size object for the returned face. This size object is directly accessible as face−>size.
NOTE: A single face object can deal with one or more size objects at a time; however, this is something that few programmers really need to do. We have thus decided to make this feature available through additional functions.
When a new face object is created, all elements are set to 0 during initialization. To populate the structure with sensible values, you should call FT_Set_Char_Size<https://freetype.org/freetype2/docs/reference/ft2-base_interface.html#ft_set_char_size>. Here is an example, setting the character size to 16pt for a 300×300dpi device:
error = FT_Set_Char_Size(
face, /* handle to face object */
0, /* char_width in 1/64th of points */
16*64, /* char_height in 1/64th of points */
300, /* horizontal device resolution */
300 ); /* vertical device resolution */
Some notes.
* The character widths and heights are specified in 1/64th of points. A point is a physical distance, equaling 1/72th of an inch. Normally, it is not equivalent to a pixel.
* Value of 0 for the character width means ‘same as character height’, value of 0 for the character height means ‘same as character width’. Otherwise, it is possible to specify different character widths and heights.
* The horizontal and vertical device resolutions are expressed in dots-per-inch, or dpi. Standard values are 72 or 96 dpi for display devices like the screen. The resolution is used to compute the character pixel size from the character point size.
* Value of 0 for the horizontal resolution means ‘same as vertical resolution’, value of 0 for the vertical resolution means ‘same as horizontal resolution’. If both values are zero, 72 dpi is used for both dimensions.
* The first argument is a handle to a face object, not a size object.
Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows