Changeset 5c27e77 in mainline for uspace/lib/gfxfont/src/text.c
- Timestamp:
- 2022-03-06T22:37:06Z (3 years ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4583015
- Parents:
- af259da
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/gfxfont/src/text.c
raf259da r5c27e77 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2022 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 229 229 { 230 230 gfx_glyph_metrics_t gmetrics; 231 gfx_font_metrics_t fmetrics; 231 232 size_t stradv; 232 233 const char *cp; 233 234 gfx_glyph_t *glyph; 234 235 gfx_coord2_t cpos; 236 gfx_coord2_t spos; 237 gfx_rect_t rect; 235 238 errno_t rc; 236 239 237 gfx_text_start_pos(font, pos, fmt, str, & cpos);240 gfx_text_start_pos(font, pos, fmt, str, &spos); 238 241 239 242 /* Text mode */ 240 243 if ((font->finfo->props.flags & gff_text_mode) != 0) 241 return gfx_puttext_textmode(font, & cpos, fmt->color, str);244 return gfx_puttext_textmode(font, &spos, fmt->color, str); 242 245 243 246 rc = gfx_set_color(font->typeface->gc, fmt->color); … … 245 248 return rc; 246 249 250 cpos = spos; 247 251 cp = str; 248 252 while (*cp != '\0') { … … 261 265 cp += stradv; 262 266 cpos.x += gmetrics.advance; 267 } 268 269 /* Text underlining */ 270 if (fmt->underline) { 271 gfx_font_get_metrics(font, &fmetrics); 272 273 rect.p0.x = spos.x; 274 rect.p0.y = spos.y + fmetrics.underline_y0; 275 rect.p1.x = cpos.x; 276 rect.p1.y = spos.y + fmetrics.underline_y1; 277 278 rc = gfx_fill_rect(font->typeface->gc, &rect); 279 if (rc != EOK) 280 return rc; 263 281 } 264 282
Note:
See TracChangeset
for help on using the changeset viewer.