Skip to content

Commit 29a71c1

Browse files
authored
Merge pull request rism-digital#4257 from rettinghaus/develop-font
make font-family a presentation attribute
2 parents cfc441f + 1ddf288 commit 29a71c1

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/svgdevicecontext.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -478,17 +478,17 @@ void SvgDeviceContext::StartPage()
478478
m_vrvTextFont = false;
479479
m_vrvTextFontFallback = false;
480480

481+
const Resources *resources = this->GetResources();
482+
481483
// default styles
482484
if (this->UseGlobalStyling()) {
483485
m_currentNode = m_currentNode.append_child("style");
484486
m_currentNode.append_attribute("type") = "text/css";
485-
const Resources *resources = this->GetResources();
486487
assert(resources);
487-
std::string css = "g.page-margin{font-family:" + resources->GetTextFont()
488-
+ ",serif;} "
489-
"g.ending, g.fing, g.reh, g.tempo{font-weight:bold;} g.dir, g.dynam, "
490-
"g.mNum{font-style:italic;} g.label{font-weight:normal;} ellipse, path, polygon, polyline, "
491-
"rect{stroke:currentColor} ";
488+
std::string css = "g.ending, g.fing, g.reh, g.tempo {font-weight:bold;} "
489+
"g.dir, g.dynam, g.mNum {font-style:italic;}"
490+
"g.label {font-weight:normal;} "
491+
"ellipse, path, polygon, polyline, rect {stroke:currentColor} ";
492492
// bounding box css - for debugging
493493
// css += " g.bounding-box{stroke:red; stroke-width:10} "
494494
// "g.content-bounding-box{stroke:blue; stroke-width:10}";
@@ -509,6 +509,7 @@ void SvgDeviceContext::StartPage()
509509
m_svgNodeStack.push_back(m_currentNode);
510510
m_currentNode.append_attribute("class") = "definition-scale";
511511
m_currentNode.append_attribute("color") = "black";
512+
m_currentNode.append_attribute("font-family") = resources->GetTextFont() + ", serif";
512513
if (this->GetFacsimile()) {
513514
m_currentNode.append_attribute("viewBox")
514515
= StringFormat("0 0 %d %d", this->GetWidth(), this->GetHeight()).c_str();

0 commit comments

Comments
 (0)