Table of Contents
qc_get_font_glyphs
Gets detailed information about characters in a font, including glyphs for each character in the given text.
details = qc_get_font_glyphs(font, text, ...) % Get character information
Gets detailed information about a font and selected characters within the font, including glyphs for the selected characters.
The details structure returned has two fields:
Field Name |
Description |
---|---|
font |
A structure describing the font metrics. |
glyphs |
A structure array describing each character in the given text, including monochrome and grayscale bitmaps for each character. |
The fields of the font structure are:
Field Name |
Description |
||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
height |
The height of characters (ascent + descent). |
||||||||||||||||||||||||||||||
ascent |
The ascent of characters i.e. units above the baseline. |
||||||||||||||||||||||||||||||
descent |
The descent of characters i.e. units below the baseline. |
||||||||||||||||||||||||||||||
internal_leading |
The amount of leading or space inside the bounds of the character height where accents and other diacritical marks may occur. |
||||||||||||||||||||||||||||||
external_leading |
The amount of extra leading or space to add between rows. This area is outside the character cell so nothing is drawn in this area. |
||||||||||||||||||||||||||||||
average_character_width |
The average width of characters in the font, which is generally the width of the character 'x'. It does not include extra width for bold or italic characters. |
||||||||||||||||||||||||||||||
maximum_character_width |
The maximum width of a character in the font. |
||||||||||||||||||||||||||||||
weight |
The weight of the font. |
||||||||||||||||||||||||||||||
overhang |
The extra width per string that may be added for some synthesized fonts, such as bold or italic fonts that are synthesized. |
||||||||||||||||||||||||||||||
digitized_aspect_x |
The horizontal aspect of the device on which the font was designed. |
||||||||||||||||||||||||||||||
digitized_aspect_y |
The vertical aspect of the device on which the font was designed. |
||||||||||||||||||||||||||||||
first_character |
The value of the first character defined in the font. |
||||||||||||||||||||||||||||||
last_character |
The value of the last character defined in the font. |
||||||||||||||||||||||||||||||
default_character |
The character to use when a character is not defined in the font. |
||||||||||||||||||||||||||||||
break_character |
The character to use when defining word breaks for text justification. |
||||||||||||||||||||||||||||||
italic |
Whether the font is italic (true) or not (false). |
||||||||||||||||||||||||||||||
underlined |
Whether the font is underlined (true) or not (false). |
||||||||||||||||||||||||||||||
struck_out |
Whether the font is struck out (true) or not (false). |
||||||||||||||||||||||||||||||
pitch |
A cell array of strings defining the pitch of the font. Possible values are:
|
||||||||||||||||||||||||||||||
family |
A string indicating the font family. Possible values are: 'decorative', 'dontcare', 'modern', 'roman', 'script', 'swiss'. |
||||||||||||||||||||||||||||||
character_set |
A string indicating the character set to which the font belongs. Possible values are: 'default', 'ansi', 'baltic', 'chinesebig5', 'easteurope', 'gb2312', 'greek', 'hangul', 'mac', 'oem', 'russian', 'shiftjis', 'symbol', 'turkish', 'vietnamese', 'johab', 'arabic', 'hebrew', 'thai'. |
||||||||||||||||||||||||||||||
panose |
A structure defining the PANOSE information for the font. If defined, the fields of the structure are:
|
||||||||||||||||||||||||||||||
selection |
A cell array of strings defining the font selection pattern. Valid strings are: 'italic', 'underscore', 'negative', 'outline', 'strikeout', 'bold'. |
||||||||||||||||||||||||||||||
licensing |
A string defining the font licensing. If it is empty there are extra licensing restrictions. Valid values are:
|
||||||||||||||||||||||||||||||
slope_rise |
The vertical displacement defining the slope of the cursor. |
||||||||||||||||||||||||||||||
slope_run |
The horizontal displacement defining the slope of the cursor. |
||||||||||||||||||||||||||||||
italic_angle |
The italic angle of the font in degrees, measured counterclockwise from vertical. It may be fractional. Italic fonts typically have a negative angle (e.g. -12 degrees) |
||||||||||||||||||||||||||||||
em_square |
The width or height of the em square for this font in logical units. |
||||||||||||||||||||||||||||||
maximum_ascent |
The maximum distance characters in this font extend above the baseline (the typographic ascent of the font). |
||||||||||||||||||||||||||||||
maximum_descent |
The maximum distance characters in this font extend below the baseline (the typographic descent of the font). |
||||||||||||||||||||||||||||||
line_gap |
The distance between lines of text when using single spacing. |
||||||||||||||||||||||||||||||
font_box |
A structure defining the bounding box for the font. The fields of the structure are: top, left, bottom, and right. |
||||||||||||||||||||||||||||||
mac_ascent |
The maximum distance characters in this font extend above the baseline on the Macintosh. |
||||||||||||||||||||||||||||||
mac_descent |
The maximum distance characters in this font extend below the baseline on the Macintosh. |
||||||||||||||||||||||||||||||
mac_line_gap |
The distance between lines of text when using single spacing on the Macintosh. |
||||||||||||||||||||||||||||||
minimum_pixels_per_em_square |
The smallest recommended size for this font in pixels per em square. |
||||||||||||||||||||||||||||||
subscript_size |
A structure defining the recommended size for subscripts. The fields of the structure are x and y. |
||||||||||||||||||||||||||||||
subscript_offset |
A structure defining the recommended offset for subscripts. The fields of the structure are x and y. |
||||||||||||||||||||||||||||||
superscript_size |
A structure defining the recommended size for superscripts. The fields of the structure are x and y. |
||||||||||||||||||||||||||||||
superscript_offset |
A structure defining the recommended offset for superscripts. The fields of the structure are x and y. |
||||||||||||||||||||||||||||||
strikeout_size |
The width of the strikeout stroke, which is usually the width of the em dash character. |
||||||||||||||||||||||||||||||
strikeout_position |
The position of the strikeout stroke relative to the baseline of the font. |
||||||||||||||||||||||||||||||
underline_size |
The thickness of the underline character. |
||||||||||||||||||||||||||||||
underline_position |
The position of the underline character relative to the baseline of the font. |
||||||||||||||||||||||||||||||
family_name |
A string defining the font family. |
||||||||||||||||||||||||||||||
face_name |
A string defining the font face. |
||||||||||||||||||||||||||||||
style_name |
A string defining the font style. |
||||||||||||||||||||||||||||||
full_name |
A string defining the full name of the font. |
The fields of the glyphs structure are:
Field Name |
Description |
||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mono_bitmap |
A monochrome bitmap of the character glyph. Each byte is either 0 or 255. This bitmap may be displayed using imshow
.
MATLAB Command Line Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window: doc('imshow'); |
||||||||||||
gray_bitmap |
A grayscale bitmap of the character glyph. The number of grayscale levels depends on the options passed to the qc_get_font_glyphs function. See the 'gray5', 'gray17' and 'gray65' options below. This bitmap may be displayed using imshow
.
MATLAB Command Line Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window: doc('imshow'); |
||||||||||||
metrics |
A structure defining certain metrics of the character glyph. The fields of the structure are:
|
||||||||||||
outline |
A structure array defining the contours for the character. This field is only defined for TrueType fonts and is useful for writing EPS or SVG files using the font, but drawing the characters as shapes rather than text. The first contour generally defines the shape of the character, while subsequent contours define holes in the character (e.g. the holes in the number '8'). The fields of the structure are:
|
font
A structure defining the font to use. The structure has the following optional fields. If a field is omitted then a suitable default is used.
Field Name |
Description |
---|---|
height |
The height of the font in pixels. |
width |
The width of the font in pixels. |
escapement |
The escapement angle in degrees (may be fractional). |
orientation |
The orientation angle in degrees (may be fractional). |
weight |
The font weight (1.0 = normal, smaller is thinner, larger is bolder, 1.75 is standard bold, 2.5 is maximum weight). |
italic |
Whether to make the font italic (true or false). |
underline |
Whether to underline the font (true or false). |
strikeout |
Whether to strike out the font (true or false). |
character_set |
A string indicating the character set to use. Valid values are: 'default', 'ansi', 'baltic', 'chinesebig5', 'easteurope', 'gb2312', 'greek', 'hangul', 'mac', 'oem', 'russian', 'shiftjis', 'symbol', 'turkish', 'vietnamese', 'johab', 'arabic', 'hebrew', 'thai'. |
output_precision |
A string indicating the output precision. Valid values are: 'default', 'character', 'device', 'outline', 'ps_only', 'raster', 'string', 'stroke', 'tt_only', 'tt'. |
clip_precision |
A string indicating the clip precision. Valid values are: 'default', 'character', 'stroke'. |
quality |
A string indicating the quality. Valid values are: 'antialiased', 'cleartype', 'default', 'draft', 'nonantialiased', 'proof'. |
pitch |
A string indicating the pitch. Valid values are: 'default', 'fixed', 'variable'. |
family |
A string indicating the family. Valid values are: 'decorative', 'dontcare', 'modern', 'script', 'swiss'. |
face |
A string containing the name of the font face to use e.g. 'Times New Roman'. |
text
A string containing the characters for which to obtain the glyph information.
...
The function may take additional options as arguments:
Option |
Description |
---|---|
'native' |
Return outlines in rasterizer's native format (default). |
'cubic' |
Return cubic Bezier splines instead of the rasterizer's native format. |
'unhinted' |
Return unhinted outlines only. |
'gray5' |
Retrieve gray_bitmap with five levels of gray |
'gray17' |
Retrieve gray_bitmap with 17 levels of gray. |
'gray65' |
Retrieve gray_bitmap with 65 levels of gray (default). |
details
A structure array containing the details about the characters in the font. See the above description for more information.
font.height = 100; % make text 100 pixels high details = qc_get_font_glyphs(font, 'abcd'); % get glyphs for the characters 'a', 'b', 'c' and 'd' imshow(details.glyphs(1).gray_bitmap); % show letter 'a' as an image
See Also
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.