Skip to content

Commit

Permalink
set dots per meter on image when drawing text
Browse files Browse the repository at this point in the history
Fixes #1805
  • Loading branch information
itsmattkc committed Dec 29, 2021
1 parent 3c95ff7 commit 1fedcf6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/node/generator/text/text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,13 @@ void TextGenerator::GenerateFrame(FramePtr frame, const GenerateJob& job) const
QImage img(frame->width(), frame->height(), QImage::Format_Grayscale8);
img.fill(Qt::transparent);

// 72 DPI in DPM (72 / 2.54 * 100)
const int dpm = 2835;
img.setDotsPerMeterX(dpm);
img.setDotsPerMeterY(dpm);

QTextDocument text_doc;
text_doc.documentLayout()->setPaintDevice(&img);

// Set default font
QFont default_font;
Expand Down

0 comments on commit 1fedcf6

Please sign in to comment.