+ uint8_t src_col = col;
+
+ /* Expanded style: advances only once every two columns. */
+ if (styles & STYLEF_EXPANDED)
+ src_col /= 2;
+
+ /* Fetch a column of dots from glyph. */
+ dots = PGM_READ_CHAR(RAST_ADDR(glyph, src_col, row_bit, glyph_width));
+
+ /* Italic: get lower 4 dots from previous column */
+ if (styles & STYLEF_ITALIC)
+ {
+ uint8_t new_dots = dots;
+ dots = (dots & 0xF0) | italic_prev_dots;
+ italic_prev_dots = new_dots & 0x0F;
+ }
+
+ /* Bold: "or" pixels with the previous column */
+ if (styles & STYLEF_BOLD)
+ {
+ uint8_t new_dots = dots;
+ dots |= prev_dots;
+ prev_dots = new_dots;
+ }
+
+ /* Underlined: turn on base pixel */
+ if ((styles & STYLEF_UNDERLINE)
+ && (row == glyph_height_bytes - 1))
+ dots |= (1 << (glyph_height - row_bit - 1));
+
+ /* Inverted: invert pixels */
+ if (styles & STYLEF_INVERT)
+ dots = ~dots;
+
+ /* Output dots */
+ #if CONFIG_TEXT_RENDER_OPTIMIZE
+ render_buf[render_xpos++] = dots;
+ if (render_xpos == RENDER_BUF_WIDTH)
+ {
+ gfx_blitRaster(bm, bm->penX + col - render_xpos + 1, bm->penY + row_bit,
+ render_buf, render_xpos,
+ MIN((uint8_t)RENDER_BUF_HEIGHT, (uint8_t)(glyph_height - row_bit)),
+ RENDER_BUF_WIDTH);
+ render_xpos = 0;
+ }
+ #else
+ gfx_blitRaster(bm, bm->penX + col, bm->penY + row_bit,
+ &dots, 1, MIN((uint8_t)8, glyph_height - row_bit), 1);
+ #endif