Repository navigation
bugfix: Add workaround to other instances where the buggy pango <sup>… #1049
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -726,6 +726,20 @@ namespace | |
|
|
||
| Result(const string& x=""): string(x) {} | ||
|
|
||
| // Pango's <sub>/<sup> markup is rendered with the wrong font size | ||
| // when the layout is created under a scaled cairo context (ticket 787), | ||
| // so use an explicit size and rise instead. | ||
| static string openTag(const string& x) | ||
| { | ||
| if (x=="sup") return "<span size=\"smaller\" rise=\"5000\">"; | ||
| if (x=="sub") return "<span size=\"smaller\" rise=\"-2000\">"; | ||
|
Comment on lines
+734
to
+735
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Canonical ids are only used for the Minsky::variableValue keys. I don't see them used elsewhere. The main purpose is to correctly identify the name strings x_1 with x_{1}, and to not identify x_10 and x_{10}. But schemas only store the LaTeX encoded name strings.
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot - see above reponse |
||
| return "<"+x+">"; | ||
| } | ||
| static string closeTag(const string& x) | ||
| { | ||
| return (x=="sup"||x=="sub")? "</span>": "</"+x+">"; | ||
| } | ||
|
|
||
| void push_back(const string& x,bool popAgain=false) | ||
| { | ||
| stack.push_back(x); | ||
|
|
@@ -749,22 +763,22 @@ namespace | |
| else | ||
| { | ||
| if (!x.empty()) | ||
| *this+="<"+x+">"; | ||
| *this+=openTag(x); | ||
| push_back(x); | ||
| input++; | ||
| } | ||
| else if (*input=='\\') | ||
| { | ||
| push_back(x,x!="{"); | ||
| if (!x.empty()) | ||
| *this+="<"+x+">"; | ||
| *this+=openTag(x); | ||
| processLaTeX(input); | ||
| return; | ||
| } | ||
| else if (x=="rm") | ||
| *this+=utf8char(input); | ||
| else if (!x.empty()) | ||
| *this+=string("<")+x+">"+utf8char(input)+"</"+x+">"; | ||
| *this+=openTag(x)+utf8char(input)+closeTag(x); | ||
| } | ||
|
|
||
| void pop() | ||
|
|
@@ -773,7 +787,7 @@ namespace | |
| do | ||
| { | ||
| if (!stack.back().empty() && stack.back()!="{") | ||
| *this+="</"+stack.back()+">"; | ||
| *this+=closeTag(stack.back()); | ||
| stack.pop_back(); | ||
| popMore.pop_back(); | ||
| } while (!stack.empty() && !popMore.empty() && popMore.back()); | ||
|
|
@@ -817,7 +831,7 @@ namespace | |
| if (*input=='[') | ||
| { | ||
| const string index=parseOpt(input); | ||
| *this+="<small><sup>"+index+"</sup></small>"; | ||
| *this+=openTag("sup")+index+closeTag("sup"); | ||
| } | ||
| *this+=latexSymbols["surd"]; | ||
| process1arg("", input); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.