Luna::Font::IFontFile::render_glyph_bitmap

virtual void render_glyph_bitmap(u32 font_index, glyph_t glyph, void *output, i32 out_w, i32 out_h, i32 out_row_pitch, f32 scale_x, f32 scale_y, f32 shift_x, f32 shift_y)=0

Renders a bitmap of the specified glyph into the buffer specified by the output., where out_w and out_h is the width and height.

The rendered bitmap is a one-channel bitmap with each pixel take one byte. The value ranges in 0-255.

This call uses CPU to rasterize the glyph, since the glyph bitmap is usually very small, this usually does not cause performance issue, but you should save the render result whenever possible.

Parameters

  • in font_index

    The index of the font to query.

  • in glyph

    The index of the glyph to query.

  • out output

    The buffer to write rendered data to.

  • in out_w

    The width of the buffer region to be used.

  • in out_h

    The height of the buffer region to be used.

  • in out_row_pitch

    The stride size, in bytes, of one row of data in the buffer.

  • in scale_x

    The scale factor in horizontal direction.

  • in scale_y

    The scale factor in vertical direction.

  • in shift_x

    The value to shift bitmap bounding box in horizontal direction in pixels.

  • in shift_y

    The value to shift bitmap bounding box in vertical direction in pixels.