Changeset d884672 in mainline for uspace/lib/gfxfont/src
- Timestamp:
- 2020-09-30T20:26:24Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c9748a4
- Parents:
- 38a4b6d
- Location:
- uspace/lib/gfxfont/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/gfxfont/src/font.c
r38a4b6d rd884672 274 274 } 275 275 276 /** Get last glyph in font. 277 * 278 * @param font Font 279 * @return Last glyph or @c NULL if there are none 280 */ 281 gfx_glyph_t *gfx_font_last_glyph(gfx_font_t *font) 282 { 283 link_t *link; 284 285 link = list_last(&font->glyphs); 286 if (link == NULL) 287 return NULL; 288 289 return list_get_instance(link, gfx_glyph_t, lglyphs); 290 } 291 292 /** Get previous glyph in font. 293 * 294 * @param cur Current glyph 295 * @return Previous glyph in font or @c NULL if @a cur was the last one 296 */ 297 gfx_glyph_t *gfx_font_prev_glyph(gfx_glyph_t *cur) 298 { 299 link_t *link; 300 301 link = list_prev(&cur->lglyphs, &cur->font->glyphs); 302 if (link == NULL) 303 return NULL; 304 305 return list_get_instance(link, gfx_glyph_t, lglyphs); 306 } 307 276 308 /** Search for glyph that should be set for the beginning of a string. 277 309 * -
uspace/lib/gfxfont/src/glyph.c
r38a4b6d rd884672 38 38 #include <errno.h> 39 39 #include <gfx/bitmap.h> 40 #include <gfx/font.h> 40 41 #include <gfx/glyph.h> 41 42 #include <io/pixelmap.h> … … 73 74 { 74 75 gfx_glyph_t *glyph; 76 gfx_glyph_t *last; 75 77 errno_t rc; 76 78 … … 88 90 } 89 91 92 last = gfx_font_last_glyph(font); 93 90 94 glyph->metrics = *metrics; 91 95 list_append(&glyph->lglyphs, &glyph->font->glyphs); 92 96 list_initialize(&glyph->patterns); 97 98 if (last != NULL) 99 glyph->rect.p0.x = last->rect.p1.x; 100 else 101 glyph->rect.p0.x = 0; 102 103 glyph->rect.p0.y = 0; 104 glyph->rect.p1.x = glyph->rect.p0.x; 105 glyph->rect.p1.y = glyph->rect.p1.y; 106 107 glyph->origin.x = glyph->rect.p0.x; 108 glyph->origin.y = glyph->rect.p0.y; 109 93 110 *rglyph = glyph; 94 111 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.