7. Macfont Info
To reduce the amount of overhead required to print a glyph,
variables are read and stored in a struct called
macfont_info
.
7.1. typedef
<<typedefs>>=
typedef struct {
<<macfont_info>>
} macfont_info;
7.2. init
The macfont_info
struct is populated with
macfont_info_init
. It does this by reading the buffer
where the font is located.
<<funcdefs>>=
void macfont_info_init(macfont_info *info, uint8_t *font);
<<funcs>>=
void macfont_info_init(macfont_info *info, uint8_t *font)
{
<<macfont_info_init>>
}
7.3. contents
7.3.1. Bitmaps
<<macfont_info>>=
uint8_t *bitmaps;
7.3.2. Off
<<macfont_info>>=
uint16_t off;
<<read_bitmap_and_off>>=
info->off = ROWWORDS(font) * RECTHEIGHT(font);
<<read_bitmap_and_off>>=
info->bitmaps = BITMAPS(font);
7.3.3. Loctable
<<macfont_info>>=
uint16_t *loctable;
<<macfont_info_init>>=
<<read_bitmap_and_off>>
info->loctable =
(uint16_t *) (info->bitmaps + (2 * info->off));
<<owtable>>
7.3.4. owtable
<<macfont_info>>=
uint16_t *owtable;
<<owtable>>=
<<read_nchars>>
info->owtable = info->loctable + (info->nchars + 2);
7.3.5. nchars
<<macfont_info>>=
uint16_t nchars;
<<read_nchars>>=
info->nchars = LASTCHAR(font) - FIRSTCHAR(font) + 1;
<<macfont_info>>=
uint16_t stride;
<<macfont_info_init>>=
info->stride = ROWWORDS(font) * 2;
7.3.6. rectheight
<<macfont_info>>=
uint16_t rectheight;
<<macfont_info_init>>=
info->rectheight = RECTHEIGHT(font);
7.3.7. kernmax
<<macfont_info>>=
int16_t kernmax;
<<macfont_info_init>>=
info->kernmax = KERNMAX(font);
7.3.8. firstchar
<<macfont_info>>=
uint16_t firstchar;
<<macfont_info_init>>=
info->firstchar = FIRSTCHAR(font);
7.3.9. font height
<<macfont_info>>=
uint16_t fontheight;
<<macfont_info_init>>=
info->fontheight = ASCENT(font) - DESCENT(font);
7.3.10. ascent + descent
<<macfont_info>>=
uint16_t descent;
uint16_t ascent;
<<macfont_info_init>>=
info->ascent = ASCENT(font);
info->descent = DESCENT(font);
7.4. helper functions
7.4.1. macinfo_fontheight
macinfo_fontheight
returns the font height.
<<funcdefs>>=
int macfont_info_fontheight(macfont_info *info);
<<funcs>>=
int macfont_info_fontheight(macfont_info *info)
{
return info->fontheight;
}
In janet, this is macfont-height
.
7.4.2. macinfo_rectheight
macinfo_rectheight
returns the font height.
<<funcdefs>>=
int macfont_info_rectheight(macfont_info *info);
<<funcs>>=
int macfont_info_rectheight(macfont_info *info)
{
return info->rectheight;
}
In janet, this is macfont-height
.
7.4.3. macinfo_descent
think it could be needed to dynamically draw symbols in a text string.
<<funcdefs>>=
int macfont_info_descent(macfont_info *info);
<<funcs>>=
int macfont_info_descent(macfont_info *info)
{
return info->descent;
}
In janet, this is macfont-height
.
prev | home | next