+ uint8_t src_col = col;
+ uint8_t i;
+
+ /* 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 * 8, 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 * 8 - 1));
+
+ /* Inverted: invert pixels */
+ if (styles & STYLEF_INVERT)
+ dots = ~dots;
+
+ /* Output dots */
+ for (i = 0; i < 8 && (row * 8) + i < glyph_height; ++i)
+ BM_DRAWPIXEL(bm, bm->penX + col, bm->penY + row * 8 + i, dots & (1<<i));