Skip to content

Commit

Permalink
Merge pull request #912 from wawuwo/873-fix-symbol-text-size
Browse files Browse the repository at this point in the history
Fix font size alteration in subcircuit component symbol
  • Loading branch information
ra3xdh authored Aug 25, 2024
2 parents 314f37a + e77a1ea commit c4f1495
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions qucs/components/component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1299,12 +1299,13 @@ int Component::analyseLine(const QString &Row, int numProps) {
if (s.isEmpty()) return -1;
misc::convert2Unicode(s);

Texts.append(new Text(i1, i2, s, Color, float(i3),
QFont Font(QucsSettings.font);
Font.setPointSizeF(float(i3));

Texts.append(new Text(i1, i2, s, Color, static_cast<double>(QFontInfo{Font}.pixelSize()),
float(cos(float(i4) * pi / 180.0)),
float(sin(float(i4) * pi / 180.0))));

QFont Font(QucsSettings.font);
Font.setPointSizeF(float(i3));
QFontMetrics metrics(Font, 0); // use the screen-compatible metric
QSize r = metrics.size(0, s); // get size of text
i3 = i1 + int(float(r.width()) * Texts.last()->mCos)
Expand Down

0 comments on commit c4f1495

Please sign in to comment.