Commit f19d591f authored by Paul Asmuth's avatar Paul Asmuth
Browse files

add font_family_css field to FontInfo

parent 34c422f4
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -57,7 +57,8 @@ ReturnCode document_setup_defaults(Document* doc) {
  }

  static const auto default_font_sans = "Arial,Helvetica:style=Regular,Roman";
  if (!findFontSystem(default_font_sans, &doc->font_sans)) {
  doc->font_sans.font_family_css = "Helvetica, Arial, sans-serif";
  if (!findFontSystem(default_font_sans, &doc->font_sans.font_file)) {
    return ReturnCode::errorf(
        "EARG",
        "unable to find default sans-sans font ($0)",
+2 −5
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ bool findFontSimple(

bool findFontSystem(
    const std::string& font_pattern,
    FontInfo* font_file) {
    std::string* font_file) {
  std::string file;

  {
@@ -78,10 +78,7 @@ bool findFontSystem(
    return false;
  }

  *font_file = FontInfo {
    .font_file = file
  };

  *font_file = file;
  return true;
}

+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ bool findFontSimple(

bool findFontSystem(
    const std::string& font_pattenr,
    FontInfo* font_file);
    std::string* font_file);

} // namespace plotfx
+1 −2
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@ Status svg_text_span(
    SVGDataRef svg) {
  const auto& style = op.style;


  svg->buffer
    << "  "
    << "<text "
@@ -56,7 +55,7 @@ Status svg_text_span(
    << "y='" << op.y << "' "
    << "fill='" << style.colour.to_hex_str() << "' "
    << "font-size='" << to_px(measures, style.font_size).value << "' "
    << "font-family='" << "\"Roboto Medium\", sans-serif" << "' "
    << "font-family='" << style.font.font_family_css << "' " // FIXME escape
    << ">"
    << op.text // FIXME escape
    << "</text>";
+1 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ enum class TextDirection {

struct FontInfo {
  std::string font_file;
  std::string font_family_css;
};

struct TextStyle {