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

implement dynamic layouting of plot axes

parent 6ea79256
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ namespace plotfx {

Document::Document() :
    width(1200),
    height(600),
    height(480),
    background_colour(Colour::fromRGB(1,1,1)),
    text_colour(Colour::fromRGB(.2,.2,.2)),
    border_colour(Colour::fromRGB(.66,.66,.66)),
+2 −1
Original line number Diff line number Diff line
@@ -183,7 +183,8 @@ Status Rasterizer::drawTextGlyphs(
    return ERROR;
  }

  if (FT_Set_Char_Size(ft_font, 0, style.font_size * 64, dpi, dpi)) {
  auto font_size_ft = style.font_size * (72.0 / dpi) * 64;
  if (FT_Set_Char_Size(ft_font, 0, font_size_ft, dpi, dpi)) {
    FT_Done_Face(ft_font);
    return ERROR;
  }
+4 −0
Original line number Diff line number Diff line
@@ -59,6 +59,10 @@ Status drawTextLabel(
    return rc;
  }

  StrokeStyle ss;
  ss.line_width = Measure(1.0);
  ss.colour = Colour::fromRGB(0.5,0.5,0.5);

  layer_ops::TextSpanOp op;
  op.text = text;
  op.position = offset;
+3 −3
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ Status text_measure_span(
    const FontInfo& font_info,
    double font_size,
    double dpi,
    TextShaper* shaper,
    const TextShaper* shaper,
    Rectangle* rect) {
  double line_length = 0;
  double top = 0.0f;
@@ -73,7 +73,7 @@ Status layoutTextLTR(
    const FontInfo& font_info,
    double font_size,
    double dpi,
    TextShaper* shaper,
    const TextShaper* shaper,
    std::function<void (const GlyphPlacement&)> glyph_cb) {
  double line_length;
  std::vector<GlyphInfo> glyphs;
@@ -119,7 +119,7 @@ Status layoutText(
    double font_size,
    double dpi,
    TextDirection direction,
    TextShaper* shaper,
    const TextShaper* shaper,
    std::function<void (const GlyphPlacement&)> glyph_cb) {
  switch (direction) {
    case TextDirection::LTR:
+2 −2
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ Status text_measure_span(
    const FontInfo& font_info,
    double font_size,
    double dpi,
    TextShaper* shaper,
    const TextShaper* shaper,
    Rectangle* rect);

/**
@@ -72,7 +72,7 @@ Status layoutText(
    double font_size,
    double dpi,
    TextDirection direction,
    TextShaper* shaper,
    const TextShaper* shaper,
    std::function<void (const GlyphPlacement&)> glyph_cb);

} // namespace text
Loading