plotters icon indicating copy to clipboard operation
plotters copied to clipboard

Font Error with Custom font configuration

Open aftix opened this issue 4 years ago • 0 comments

Trying to run the code

    let mut chart = ChartBuilder::on(&root)
        .caption(
            "Mercury Latent Heat of Vaporization",
            ("Inconsolata", 50).into_font(),
        )
        .margin(5)
        .x_label_area_size(30)
        .y_label_area_size(30)
        .build_cartesian_2d(500f32..700f32, 48000f32..64000f32)?;

with any font name results in Error: BackendError(FontError(FontLoadError(IllFormed))). I have a ~/.config/fontconfig/fonts.conf of the following:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
<match target="pattern">
  <test qual="any" name="family"><string>serif</string></test>
  <edit name="family" mode="assign" binding="same"><string>Source Han Serif JP</string></edit>
</match>
<match target="pattern">
  <test qual="any" name="family"><string>sans-serif</string></test>
  <edit name="family" mode="assign" binding="same"><string>Source Han Sans JP</string></edit>
</match>
<match target="pattern">
  <test qual="any" name="family"><string>monospace</string></test>
  <edit name="family" mode="assign" binding="same"><string>WenQuanYi Zen Hei Mono</string></edit>
</match>
</fontconfig>

created from instructions on https://wiki.archlinux.org/title/Font_configuration#Replace_or_set_default_fonts . Removing this configuration file fixes the issue. This is the only software I've run into troubles on. $ fc-match sans-serif successfully finds Source Han Sans JP.

aftix avatar Sep 20 '21 21:09 aftix