+ uint8_t src_col = col;
+ uint8_t i;
+
+ /* Expanded style: advances only once every two columns. */
+ if (bm->styles & STYLEF_EXPANDED)
+ src_col /= 2;
+
+ /* Fetch a column of dots from glyph. */
+ dots = PGM_READ_CHAR(glyph + src_col * glyph_height_bytes + row);
+
+ /* Italic: get lower 4 dots from previous column */
+ if (bm->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 (bm->styles & STYLEF_BOLD)
+ {
+ uint8_t new_dots = dots;
+ dots |= prev_dots;
+ prev_dots = new_dots;
+ }
+
+ /* Underlined: turn on base pixel */
+ if (bm->styles & STYLEF_UNDERLINE)
+ dots |= 0x80;
+
+ /* Inverted: invert pixels */
+ if (bm->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));