Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix font size alteration in subcircuit component symbol #912

Merged
merged 1 commit into from
Aug 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading