gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/agg-plot/text_label.h
diff options
context:
space:
mode:
Diffstat (limited to 'agg-plot/text_label.h')
-rw-r--r--agg-plot/text_label.h 34
1 files changed, 17 insertions, 17 deletions
diff --git a/agg-plot/text_label.h b/agg-plot/text_label.h
index 209876ba..0221077a 100644
--- a/agg-plot/text_label.h
+++ b/agg-plot/text_label.h
@@ -20,9 +20,8 @@ class text_label
str m_text_buf;
double m_width;
- double m_height;
-
- double m_scale_x, m_scale_y;
+ double m_font_height;
+ double m_font_width;
unsigned m_pos;
double m_x, m_y;
@@ -38,27 +37,21 @@ class text_label
public:
text_label(const char* text, double size):
- m_text_buf(text), m_height(size), m_scale_x(1), m_scale_y(1), m_pos(0),
+ m_text_buf(text), m_font_height(size), m_font_width(size),
m_font_eng(gslshell::font_engine()), m_font_man(gslshell::font_manager()),
m_model_mtx(&identity_matrix),
m_text_curve(m_font_man.path_adaptor()), m_text_trans(m_text_curve, m_text_mtx)
{
- set_font_size();
+ update_font_size();
m_width = get_text_width();
}
void model_mtx(const agg::trans_affine& m) { m_model_mtx = &m; }
- void set_font_size()
- {
- m_font_eng.height(m_scale_y * m_height);
- m_font_eng.width(m_scale_x * m_height * scale_x);
- }
-
- void scale_font(double f_scale_x, double f_scale_y)
+ void font_size(double height, double width)
{
- m_scale_x = f_scale_x;
- m_scale_y = f_scale_y;
+ m_font_height = height;
+ m_font_width = width;
}
const str& text() const { return m_text_buf; }
@@ -94,7 +87,7 @@ class text_label
void rewind(double hjustif, double vjustif)
{
m_x = scale_x * (- hjustif * m_width);
- m_y = round(- 0.86 * vjustif * m_height);
+ m_y = round(- 0.86 * vjustif * m_font_height);
m_advance_x = 0;
m_advance_y = 0;
m_pos = 0;
@@ -103,7 +96,7 @@ class text_label
agg::trans_affine_scaling scale_mtx(1.0 / double(scale_x), 1.0);
trans_affine_compose (m_text_mtx, scale_mtx);
- set_font_size();
+ update_font_size();
load_glyph();
}
@@ -124,7 +117,7 @@ class text_label
void approximation_scale(double as) { m_text_curve.approximation_scale(as); }
- double get_text_height() const { return m_height; }
+ double get_text_height() const { return m_font_height; }
double get_text_width()
{
@@ -145,6 +138,13 @@ class text_label
return x / double(scale_x);
}
+
+private:
+ void update_font_size()
+ {
+ m_font_eng.height(m_font_height);
+ m_font_eng.width(m_font_width * scale_x);
+ }
};
#endif
generated by cgit v1.2.3 (git 2.46.0) at 2025年09月29日 09:14:06 +0000

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