mirror of
https://github.com/KLayout/klayout.git
synced 2026-09-06 17:33:25 +02:00
Fixed text bbox computation under the presence of global view transformations and 'apply text transformation' false
This commit is contained in:
@@ -47,7 +47,10 @@ TEST(1)
|
||||
// Default font
|
||||
lay::TextInfo ti (&lv);
|
||||
EXPECT_EQ (ti.bbox (text, db::DCplxTrans ()).to_string (), "(12,22;36,37)");
|
||||
// global transformation changes the dimension as the default font is not scaled or rotated
|
||||
EXPECT_EQ (ti.bbox (text, db::DCplxTrans (2.0)).to_string (), "(11,21;23,28.5)");
|
||||
EXPECT_EQ (ti.bbox (text, db::DCplxTrans (db::DFTrans (1))).to_string (), "(12,-6;27,18)");
|
||||
// long text
|
||||
EXPECT_EQ (ti.bbox (text2, db::DCplxTrans ()).to_string (), "(12,22;60,52)");
|
||||
|
||||
// valign
|
||||
@@ -69,6 +72,11 @@ TEST(1)
|
||||
ti = lay::TextInfo (&lv);
|
||||
|
||||
EXPECT_EQ (ti.bbox (text, db::DCplxTrans ()).to_string (), "(12,15;72,47)");
|
||||
// global trans only scales pixel-based border but does not modify the outline in
|
||||
// "apply transformation" mode
|
||||
EXPECT_EQ (ti.bbox (text, db::DCplxTrans (2.0)).to_string (), "(11,14;71,46)");
|
||||
EXPECT_EQ (ti.bbox (text, db::DCplxTrans (db::DFTrans (1))).to_string (), "(12,15;72,47)");
|
||||
// long text
|
||||
EXPECT_EQ (ti.bbox (text2, db::DCplxTrans ()).to_string (), "(12,15;134,83)");
|
||||
|
||||
// valign
|
||||
@@ -110,4 +118,9 @@ TEST(1)
|
||||
lv.apply_text_trans (false);
|
||||
ti = lay::TextInfo (&lv);
|
||||
EXPECT_EQ (ti.bbox (text3, db::DCplxTrans ()).to_string (), "(12,20.6;36.4,34.2)");
|
||||
// with apply_text_trans false, the global transformation does change the text
|
||||
// bounding box.
|
||||
EXPECT_EQ (ti.bbox (text, db::DCplxTrans ()).to_string (), "(12,20.6;24,27)");
|
||||
EXPECT_EQ (ti.bbox (text, db::DCplxTrans (2.0)).to_string (), "(11,19.6;23,26)");
|
||||
EXPECT_EQ (ti.bbox (text, db::DCplxTrans (db::DFTrans (1))).to_string (), "(10.6,6;17,18)");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user