Skip to content

bittermelon v2.3.1

Latest

Choose a tag to compare

@trevorld trevorld released this 27 Mar 20:49
· 1 commit to main since this release

Breaking changes

  • write_hex() and write_yaff() now throw an error instead of automatically clamping when given multi-colored glyphs.

    • Now explicitly use bm_lapply(font, as_bm_bitmap) and/or bm_clamp(font) to cast to an appropriate font object before writing.

New features

  • as_bm_pixmap() gains a character method analogous to as_bm_bitmap.character() for rendering strings from a bm_font() font.
  • read_yaff() now supports the experimental levels property for greyscale fonts returning a bm_font() with bm_pixmap() glyphs. Uninked pixels are encoded as "#FFFFFF00" (transparent). read_yaff() gains a fg argument (default "#000000FF") to control the foreground color; its RGB values are used for inked pixels and its alpha is multiplied by the level fraction to set pixel transparency.
  • bm_bytepad() pads bitmap widths to the nearest multiple of 8 (i.e. nearest byte) by adding pixels on the right (e.g. as required by the BDF font format) (#43).
  • bm_extend() gains a mode argument. The default mode = "constant" fills new pixels with value (existing behavior). Use mode = "edge" to fill new pixels by replicating the nearest edge pixel (#81).
  • bm_extend() gains width_multiples_of and height_multiples_of arguments that pad the bitmap's width or height to the nearest multiple of a given integer (#43).
  • bm_rotate() gains in_place and value arguments to rotate the glyph in place without changing the background padding (#70).
  • bm_shift() gains an overflow argument. The default overflow = "clip" silently clips content that would be pushed off the bitmap (matching the previous behavior). Use overflow = "error" to throw an error if non-padding content would be clipped, or overflow = "wrap" to wrap content around to the other side (#74).
  • summary.bm_font() summarizes a bm_font() object, showing the font name (if available), the bitmap class, the number of characters, and coverage of Unicode blocks (#35).

Bug fixes and minor improvements

  • is_bm_list() gains a class argument to optionally check that all elements inherit from at least one of the specified classes.
  • read_monobit() gains a ... argument that is passed on to read_yaff(), allowing use of arguments such as fg.
  • read_yaff() now correctly reads multi-line property values; they are stored as a length-one character string with embedded newlines. Previously, a bug caused incorrect indices to be used when computing value ranges, and the values were stored as a character vector.
  • read_yaff() now correctly captures global comments from files where every line is a comment (no blank lines). Previously, line indices were returned instead of the comment strings.
  • Slicing a bm_font() or bm_list() with [ now preserves the class and attributes (including comments and properties) of the original object.