Snap to grid the x axis for text when it is rotated at +/- 90 degree - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/agg-plot
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2012年08月08日 23:24:15 +0200
committerFrancesco Abbate <francesco.bbt@gmail.com>2012年08月08日 23:24:15 +0200
commit5ca378bdbfd044ea97764877f06e1ee6e48c255d (patch)
treea0c6169baa21bf5d00c440e3a57caf506f4df34b /agg-plot
parent37791df9f7ab54333c95894df33114e4d5a02310 (diff)
downloadgsl-shell-5ca378bdbfd044ea97764877f06e1ee6e48c255d.tar.gz
Snap to grid the x axis for text when it is rotated at +/- 90 degree
Diffstat (limited to 'agg-plot')
-rw-r--r--agg-plot/text_label.h 13
1 files changed, 9 insertions, 4 deletions
diff --git a/agg-plot/text_label.h b/agg-plot/text_label.h
index 15164ff9..8d5d7293 100644
--- a/agg-plot/text_label.h
+++ b/agg-plot/text_label.h
@@ -77,11 +77,16 @@ class text_label
if(glyph->data_type == agg::glyph_data_outline)
{
- m_text_mtx.tx = m_x / scale_x;
- m_text_mtx.ty = m_y;
- m_model_mtx->transform(&m_text_mtx.tx, &m_text_mtx.ty);
+ agg::trans_affine& m = m_text_mtx;
- grid_fit::adjust(m_text_mtx.tx, m_text_mtx.ty);
+ m.tx = m_x / scale_x;
+ m.ty = m_y;
+ m_model_mtx->transform(&m.tx, &m.ty);
+
+ if (fabs(m.sx * m.sy) > fabs(m.shx * m.shy))
+ grid_fit::adjust(m.tx, m.ty);
+ else
+ grid_fit::adjust(m.ty, m.tx);
m_advance_x = glyph->advance_x;
m_advance_y = glyph->advance_y;
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月14日 22:23:34 +0000

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