-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add support for math text glyphs #13612
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## branch-3.4 #13612 +/- ##
===========================================
Coverage 92.53% 92.54%
===========================================
Files 323 323
Lines 20476 20493 +17
===========================================
+ Hits 18948 18965 +17
Misses 1528 1528 |
@mattpap The images and animations you often include in PRs are really great, but FYI I'm usually left wishing the code that generated them was available in order to try things out or experiment with the API. |
942a6ac
to
f8c4832
Compare
export {HAreaStep} from "./harea_step" | ||
export {HArea} from "./harea" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand these re-orderings
In [4]: "HArea" < "HAreaStep"
Out[4]: True
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use vim's (or equivalent) :sort
command, which is non-semantic, thus it compares S
< }
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I resorted this the way eslint would. At some point, when there are fewer open PRs, I will most likely enable relevant lint rules to systematically organize imports and exports.
Generally LGTM, a couple of comments/questions:
Lastly, folks have at times asked for a unified text API that supports math text inside using |
Not necessarily. However, I didn't want to further bloat |
f8c4832
to
5c4e1a9
Compare
There aren't many possibilities when dealing with naming conflicts:
For the purpose of this PR the first seems to be the simplest to go with, especially that an average user will use |
Co-authored-by: Moritz Schreiber <68053396+mosc9575@users.noreply.github.com>
OT: We are adding enough new models that it's reasonable to consider. Like I said in the other issue, we just need to have a detailed and specific actual plan that is agreed up front. I would say we have one shot to define a hierarchy structure for models to slot into, so we need to be deliberate about the conceptual basis for that structure, how it might be extended, in the future, how documentation will adapt, etc. And also how to handle a smooth transition period (for at least a few years I would guess). |
This adds support for
TeXGlyph
andMathMLGlyph
, which mirror functionality ofTeX
andMathML
models (thusGlyph
suffix), but for vectorized inputs. I also addedtex()
andmathml()
methods to glyph APIs (infigure
). From performance perspective this may not be the best implementation for the time being, but at least it guarantees no flickering. Alternatively I would have to go theImageURL
route, which isn't great either.TeXGlyph
supports three display modes:"auto"
(the default), wheretext
's values are parsed, requiring TeX delimiters to enclose math content, e.g.$$x^2$$
. TeX display mode is inferred by the parser."block"
, wheretext
's values are taken verbatim and TeX's block mode is used."inline"
, wheretext
's values are taken verbatim and TeX's inline mode is used.Exmple: (
inline
,block
display, and normalText
glyph for comparison):Python: