kanjimat {kanjistat} | R Documentation |
Create kanjimat objects
Description
Create a (list of) kanjimat object(s), i.e. bitmap representations of a kanji using a certain font-family and other typographical parameters.
Usage
kanjimat(
kanji,
family = NULL,
size = NULL,
margin = 0,
antialias = TRUE,
save = FALSE,
overwrite = FALSE,
simplify = TRUE,
...
)
Arguments
kanji |
a (vector of) character string(s) containing kanji. |
family |
the font-family to be used. For details see vignette. |
size |
the sidelength of the (square) bitmap |
margin |
numeric. Extra margin around the character. Defaults to 0 which leaves a relatively slim margin. Positive values increase this margin, negative values decrease it (which usually cuts off part of the kanji). |
antialias |
logical. Shall antialiasing be performed? |
save |
logical or character. If FALSE return the (list of) kanjimat object(s). Otherwise save the result as an rds file in the working directory (as kmatsave.rds) or under the file path provided. |
overwrite |
logical. If FALSE return an error (before any computations are done) if the designated file path already exists. Otherwise an existing file is overwritten. |
simplify |
logical. Shall a single kanjimat object be returned (instead a list of one) if |
... |
futher arguments passed to png. This is for extensibility. The only argument
that may currently be used is |
Value
A list of objects of class kanjimat
or, if only one kanji was specified and
simplify
is TRUE
, a single objects of class kanjimat
. If save = TRUE
,
the same is (saved and) still returned invisibly.
Warning
If no font family is provided, the default Chinese font WenQuanYi Micro Hei that comes with the package showtext is used. This means that the characters will typically be recognizable, but quite often look odd as Japanese characters. We strongly advised that a Japanese font is used as detailed above.
Examples
res <- kanjimat(kanji="\u85e4", size = 128)