Title: | 'GNU Unifont' Hex Fonts |
---|---|
Description: | Contains most of the hex font files from the 'GNU Unifont Project' <https://unifoundry.com/unifont/> compressed by 'xz'. 'GNU Unifont' is a duospaced bitmap font that attempts to cover all the official Unicode glyphs plus several of the artificial scripts in the '(Under-)ConScript Unicode Registry' <http://www.kreativekorp.com/ucsur/>. Provides a convenience function for loading in several of them at the same time as a 'bittermelon' bitmap font object for easy rendering of the glyphs in an 'R' terminal or graphics device. |
Authors: | Trevor L Davis [aut, cre] , GNU Unifont authors [cph] |
Maintainer: | Trevor L Davis <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.4.0 |
Built: | 2024-11-11 03:44:10 UTC |
Source: | https://github.com/trevorld/hexfont |
The function unifont()
loads in several GNU Unifont hex files as a
single bittermelon::bm_font()
object.
unifont(upper = TRUE, jp = FALSE, csur = TRUE, sample = FALSE, ucp = NULL)
unifont(upper = TRUE, jp = FALSE, csur = TRUE, sample = FALSE, ucp = NULL)
upper |
Include glyphs above the Unicode Basic Multilingual plane. |
jp |
Use Japanese version of Chinese characters. |
csur |
Include (Under-)Conscript Unicode Registry glyphs. |
sample |
Add circle to "Combining" characters. |
ucp |
Character vector of Unicode Code Points: glyphs not in this vector won't be read in.
If |
A bittermelon::bm_font()
object.
# Much faster to load only the subset of GNU Unifont one needs # Mandarin Chinese if (require("bittermelon")) { s <- "\uff32\u5f88\u68d2\uff01" font <- unifont(ucp = str2ucp(s)) bm <- as_bm_bitmap(s, font = font) print(bm, px = px_ascii) } # Emoji if (require("bittermelon")) { s <- "\U0001f42d\U0001f432\U0001f435" font <- unifont(ucp = str2ucp(s)) bm <- as_bm_bitmap(s, font = font) print(bm, px = px_ascii) }
# Much faster to load only the subset of GNU Unifont one needs # Mandarin Chinese if (require("bittermelon")) { s <- "\uff32\u5f88\u68d2\uff01" font <- unifont(ucp = str2ucp(s)) bm <- as_bm_bitmap(s, font = font) print(bm, px = px_ascii) } # Emoji if (require("bittermelon")) { s <- "\U0001f42d\U0001f432\U0001f435" font <- unifont(ucp = str2ucp(s)) bm <- as_bm_bitmap(s, font = font) print(bm, px = px_ascii) }
unifont_combining()
returns a character vector of the code points
for all the "combining" characters in Unifont.
unifont_combining(upper = TRUE, csur = TRUE, unicode = FALSE)
unifont_combining(upper = TRUE, csur = TRUE, unicode = FALSE)
upper |
Include glyphs above the Unicode Basic Multilingual plane. |
csur |
Include (Under-)Conscript Unicode Registry glyphs. |
unicode |
Include combining glyphs assigned by the Unicode Consortium
(i.e. not ones in the Private Use Area like the CSUR ones).
By default |
A character vector of Unicode code points
Can be used with the pua_combining
argument of bittermelon::bm_compose()
and bittermelon::as_bm_bitmap()
.
uc <- unifont_combining() print(uc) # Tengwar with combining glyphs if (require("bittermelon")) { s <- "\ue004\ue014\ue04a\ue005\ue000\ue040\ue022\ue04a\ue003\ue04e" font <- unifont(ucp = str2ucp(s)) bml <- as_bm_list(s, font = font) to_raise <- which(names(bml) %in% c("U+E04A", "U+E04E")) bml[to_raise] <- bm_shift(bml[to_raise], top = 1L) bml <- bm_compose(bml, pua_combining = uc) bml <- bm_pad(bml, type = "trim", left = 1L, right = 0L) bm <- bm_call(bml, cbind) print(bm, px = px_ascii) }
uc <- unifont_combining() print(uc) # Tengwar with combining glyphs if (require("bittermelon")) { s <- "\ue004\ue014\ue04a\ue005\ue000\ue040\ue022\ue04a\ue003\ue04e" font <- unifont(ucp = str2ucp(s)) bml <- as_bm_list(s, font = font) to_raise <- which(names(bml) %in% c("U+E04A", "U+E04E")) bml[to_raise] <- bm_shift(bml[to_raise], top = 1L) bml <- bm_compose(bml, pua_combining = uc) bml <- bm_pad(bml, type = "trim", left = 1L, right = 0L) bm <- bm_call(bml, cbind) print(bm, px = px_ascii) }
The function unifont_version()
returns the GNU Unifont version number
this package packed their hex
files from.
unifont_version()
unifont_version()
The Unifont version number as a numeric_version()
class.
unifont_version()
unifont_version()