Add support to scale font directly inside text_label - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/agg-plot/text-shape.h
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2012年08月07日 17:19:04 +0200
committerFrancesco Abbate <francesco.bbt@gmail.com>2012年08月07日 17:19:04 +0200
commit5d5237a6688d733c645a1df04471545036f94c7a (patch)
tree1f2621c970ec63ef14d0d845c609d75f4d2818a4 /agg-plot/text-shape.h
parent78086498f6df8d08b540608dbf91337611864dc9 (diff)
downloadgsl-shell-5d5237a6688d733c645a1df04471545036f94c7a.tar.gz
Add support to scale font directly inside text_label
Useful to have scaled text with accurately hinted glyphs.
Diffstat (limited to 'agg-plot/text-shape.h')
-rw-r--r--agg-plot/text-shape.h 18
1 files changed, 14 insertions, 4 deletions
diff --git a/agg-plot/text-shape.h b/agg-plot/text-shape.h
index 38abf892..aadbe147 100644
--- a/agg-plot/text-shape.h
+++ b/agg-plot/text-shape.h
@@ -15,6 +15,7 @@ namespace draw {
m_matrix.tx = x;
m_matrix.ty = y;
m_text_label.model_mtx(m_matrix);
+ compute_bounding_box();
}
virtual void rewind(unsigned path_id)
@@ -32,12 +33,20 @@ namespace draw {
virtual void bounding_box(double *x1, double *y1, double *x2, double *y2)
{
+ *x1 = m_bbox.x1;
+ *y1 = m_bbox.y1;
+ *x2 = m_bbox.x2;
+ *y2 = m_bbox.y2;
+ }
+
+ void compute_bounding_box()
+ {
const double pad = 1.0;
const double tx = m_matrix.tx, ty = m_matrix.ty;
- *x1 = tx - pad;
- *y1 = ty - pad;
- *x2 = tx + m_text_label.get_text_width() + pad;
- *y2 = ty + m_text_label.get_text_height() + pad;
+ m_bbox.x1 = tx - pad;
+ m_bbox.y1 = ty - pad;
+ m_bbox.x2 = tx + m_text_label.get_text_width() + pad;
+ m_bbox.y2 = ty + m_text_label.get_text_height() + pad;
}
virtual str write_svg(int id, agg::rgba8 c, double h)
@@ -74,6 +83,7 @@ namespace draw {
agg::trans_affine m_matrix;
const agg::trans_affine* m_scaling;
double m_size;
+ agg::rect_base<double> m_bbox;
};
}
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月30日 14:25:49 +0000

AltStyle によって変換されたページ (->オリジナル) /