-
Notifications
You must be signed in to change notification settings - Fork 664
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
Allow font attributes to be ignored in SVG context #1505
Comments
For 1, my thought was to have Font.DEFAULT_FAMILY which was a global and set by default to Font.SANS_SERIF (a constant) but could be overriden globally. And same with size... For 2, if you could do 3 (opt out), you could use media selectors and classes to do font size with % or REM in css. For 4. I don't understand - can you give an example? The idea behind the changes in text font handling is to allow precise formatting when mixing glyphs and text (without using getBBox). Since music glyphs already use point size, it makes sense to use that as a default size and convert from any other measure. You can always create an svg text element if you need something vexflow doesn't provide, and it seems like relative text size may be a case where that would be appropriate. Vexflow can't help you format the text vs. the music in that case, anyway. |
The problem is that then that text element has to know what the text style of the surrounding HTML is, since it can no longer just inherit. (I use text in Vexflow in a number of different contexts with different font styles)
I'm not sure if it's an actual problem but it looks like it might be. The constructor sets Our workaround solution has been to strip all the font attributes from the SVGSVGElement after vexflow creates it but prior to appending it to the DOM. Your solution on 1 is probably what we should be doing. Thanks! |
(Continuing with things in 4 that are regressions in my use cases)
Currently the font-family, font-size, etc. attributes for the
<svg>
object can be specified in the Font.SANS_SERIF, etc. properties, but there are a number of things that were possible in Vexflow 1.2 that are not possible now.<svg>
object so that it can inherit style/family from the surrounding object. -- ATTRIBUTES_TO_IGNORE is not exported in svgcontext so it's not possible to setsvg: {'font-family': true}
<svg>
object.Thanks! These might be unusual cases, but it's helpful for things like putting input boxes at the proper location next to a note to use the
<foreign-object>
tag within an SVG, but then they are inheriting all of the default SVG attributesThe text was updated successfully, but these errors were encountered: