Skip to content

Commit

Permalink
Fix font names and pdf creation
Browse files Browse the repository at this point in the history
  • Loading branch information
parapente committed Jun 23, 2023
1 parent 9ccc218 commit db9bbbe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/extraText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ ExtraText::ExtraText(std::string text) {

if (std::regex_match(token, match, style_r)) {
if (match[1].str() == "i") {
m_style = "Italic";
m_style = "Oblique";
}

if (match[1].str() == "b") {
m_style = "Bold";
}

if (match[1].str() == "bi" || match[1].str() == "ib") {
m_style = "BoldItalic";
m_style = "BoldOblique";
}

logger << "ExtraText.style = " << m_style << "\n";
Expand Down
9 changes: 4 additions & 5 deletions src/pdfProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,13 +378,12 @@ void PDFProcessor::addExtraText(std::string text, float x, float y,
new_font_name = found_name;
}

// TODO: Position text
m_firstPage.addPageContents(
QPDFObjectHandle::newStream(
&m_pdf, new_font_name + std::to_string(font_name_increment) + " " +
std::to_string(font_size) + " Tf 1 0 0 1 " +
std::to_string(x) + " " + std::to_string(y) + " Tm (" +
text + ") Tj"),
&m_pdf,
"BT " + new_font_name + std::to_string(font_name_increment) + " " +
std::to_string(font_size) + " Tf 1 0 0 1 " + std::to_string(x) +
" " + std::to_string(y) + " Tm (" + text + ") Tj ET"),
false);
logger << "Adding text...\n";
}
Expand Down

0 comments on commit db9bbbe

Please sign in to comment.