Skip to contents

bittermelon 2.3.1

CRAN release: 2026-03-27

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.

bittermelon 2.2.1

CRAN release: 2026-01-29

New features

  • bm_extract() can extract parts of a bitmap (#89).
  • is_supported_bitmap() tests whether the object is one of the bitmap formats supported by the functions in this package (i.e. bm_bitmap, bm_pixmap, magick-image, nativeRaster, or raster).

Bug fixes and minor improvements

bittermelon 2.1.1

CRAN release: 2025-01-16

New features

Bug fixes and minor improvements

bittermelon 2.0.2

CRAN release: 2024-06-25

Breaking changes

  • We no longer embed an increasingly outdated version of monobit.

    • monobit has now grown too large to embed within bittermelon and stay within CRAN package size limits.
    • Users interested in reading/writing bitmap fonts formats other than .hex and .yaff files will need to manually install their own version of monobit using pip3 install monobit.
    • The interpretation of the argument monobit_path in read_monobit() and write_monobit() and the global option bittermelon.monobit_path has been changed and now means the path to pass to base::Sys.which() (if the new default name "monobit-convert" is not good enough).
    • Any previously installed versions of monobit to rappdirs::site_config_dir("bittermelon", "monobit") or rappdirs::user_config_dir("bittermelon", "monobit") will now be ignored. Please consider deleting them or update the bittermelon.monobit_path option to point to them.
    • The function update_monobit() has been removed.
  • The default col argument to as.raster.bm_bitmap() and plot.bm_bitmap() is now getOption("bittermelon.col", col_bitmap) where the newly exported col_bitmap = c("transparent", "black", "grey50", "grey25"). In particular by default 0L values will now be cast to “transparent” instead of “grey80”. To get the old behaviour set options("bittermelon.col" = c("grey80", "black", "grey40")).

  • We no longer export a generic S3 which() method which by default calls base::which() and remove the special which.bm_bitmap() method that first cast to a logical. Instead now use which(as.logical(x)) for bm_bitmap() objects.

  • Many functions were upgraded to S3 generics that support more bitmap objects. The first argument of these functions are now usually x instead of bm_object. If specifying the first argument by name instead of positionally you’ll now need to use x instead.

  • bm_distort() is now a wrapper around magick::image_resize(). x, width, and height are now the only supported positional arguments and the interpolate, vp, and png_device arguments are no longer supported. It now requires the suggested package magick.

  • The default for height in bm_expand() is now the value of width i.e. bm_expand(x, 2L) will now double the size of x in both directions. To get the previous behaviour you may now need to explicitly set height = 1L.

New features

Bug fixes and minor improvements

  • The bg and fg arguments of format.bm_bitmap() and print.bm_bitmap() now accept lists of cli ANSI style functions in addition to color strings.
  • print.bm_bitmap() no longer silently ignores its compress argument.
  • The default value of the option bittermelon.px is now px_auto(). This means if cli::is_utf8_output() is FALSE we now default to px_ascii instead of px_unicode.
  • Fixes bugs in write_monobit(), write_yaff(), and the unit tests if any of the options bittermelon.fg, bittermelon.bg, or bittermelon.compress are set away from their defaults.
  • read_yaff() now correctly handles octal codepoint and (single) character labels.
  • write_yaff() now encloses “tag” labels with double quotes.
  • hex2ucp() now also calls base::toupper() on the input value.
  • bm_bitmap() objects now also have the class "bm_matrix" (as does the new bm_pixmap() objects).
  • format.bm_bitmap(x) no longer throws an error when x has zero columns (#68).
  • bm_flip() now has a value argument to set the background padding value to use if in_place is TRUE.

bittermelon 1.1.2

CRAN release: 2023-12-15

Bug fixes and minor improvements

bittermelon 1.1.1

CRAN release: 2023-02-12

New features

  • read_hex() has new argument ucp. Character vector of Unicode Code Points: glyphs not in this vector won’t be read in. If NULL (default) read every glyph in the font (#52).

Bug fixes and minor improvements

bittermelon 1.0.0

CRAN release: 2022-08-15

This update has no user-facing changes (at the request of CRAN we re-built our package man pages with an updated version of the roxygen2 package to avoid a deprecated html image alignment warning).

bittermelon 0.2.1

CRAN release: 2021-11-01

New features

  • New function bm_compose() simplifies bm_list() object by applying combining marks to preceding glpyhs (composing new graphemes) (#42).
  • as_bm_bitmap.character() has new arguments compose and pua_combining to compose graphemes using combining characters.
  • as_bm_bitmap.character() direction argument now supports combining in combinations of horizontal/vertical directions such as left-to-right, top-to-bottom (#47).
  • is_combining_character() has new argument pua_combining which is character vector of additional Unicode code points to be considered “combining” characters (such as those in the Private Use Area of a font). Defaults to character(0).
  • We now include the 5x8 Fixed font (in addition to the 4x6 and 6x13 Fixed fonts already included in earlier version).
  • read_monobit() and write_monobit() take new argument monobit_path indicating the directory path containing monobit to use. Default will be to look in file.path(rappdirs::user_config_dir("bittermelon"), "monobit"), file.path(rappdirs::site_config_dir("bittermelon"), "monobit"), and system.file("monobit", package = "bittermelon") (in that order). New package option bittermelon.monobit_path can be used to set a new default. (#48)
  • New function update_monobit() which downloads the most up to date (upstream) version of monobit. Although we continue to embed an older, more compact version of monobit in this package the newest versions of monobit are too large to embed within this package and must be downloaded separately.

Bug fixes and minor improvements

  • Updates the embedded version of monobit. In particular monobit should now better handle Amiga, AngelCode BMFont, X11/Adobe BDF, and C/C++ source code bitmap fonts and be able to natively read/write bzip2, gzip, or lzma compressed fonts.
  • Fixes bug in is_combining_character(). Now “combining enclosing” characters are correctly classified as combining characters.
  • Fixes bug in bm_expand() for bitmaps with zero columns/rows.

bittermelon 0.1.3

CRAN release: 2021-09-09