-
Notifications
You must be signed in to change notification settings - Fork 623
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
SVG font: extract SVG per character #1192
Comments
Memory consuming? How? :) You can download them from https://github.com/twitter/twemoji/tree/gh-pages/2/svg also |
You can go for this
You know, creating a perfect dumper is not that easy but I guess that suits your need Am closing this issue but feel free to continue the discussion if you had any question :) |
Hello @ebraminio, Thank you for your reply.
Instead of loading SVGs one by one to memory when a user requested a character to be rendered, I will have to load into memory all SVGs no matter whether or not they were actually used. Thus generation of all SVGs from the font does not solve the problem, because what we need is to load only specific SVG per character. Does this functionality exist?
I wasn't able to find the part of hb_shape which takes SVG as an input. Could you please give more details here? I would consider this problem as still open, as a main issue - loading SVGs one by one is not solved. Thank you. |
Oh, you don't have to. If you glyph id, you can retrieve that glyph like this https://github.com/harfbuzz/harfbuzz/blob/master/src/hb-ot-color-svg-table.hh#L118-L119 see "entry.startGlyphID, entry.endGlyphID)" part, one can write a binary search The issue is however use of SVG is not publicly available till the fix #881. If you can't private API of harfbuzz (that is likely going to break) you should follow that issue.
Oh that's not what harfbuzz as a library is responsible for. HarfBuzz main business is to get characters and give glyph ids from fonts and their [relative] position. What we like to implement on HarfBuzz for SVG table is to just return SVG blob for a given SVG but even if we don't, our client are able to do already without HarfBuzz, they just have the same logic by their own, which could be easy or hard given utilities they have on their project. Generally this is out of scope for harfbuzz (except #881 part) a as a project but I personally really like to help you so feel free to continue if you had question :) |
Hello @ebraminio , Thank you for your response!
How should I get the glyph ID per character if we are talking about vector font? Does the regular font parsing from harfbuzz work for SVG fonts as well? Thanks 👍 |
You are talking about svg in opentype, not the independent but old and
deprecated SVG fonts right? See hb-shape and its options, if you give it an
emoji, it returns glyph id of the font related to that emoji (it prints
glyph names by default but you can turn it to glyph ids). You should first
however find the list all emojis available from somewhere, you can use
Unicode's emoji standard or the following page that enlists all the
available free emoji https://commons.wikimedia.org/wiki/Emoji
After finding the emoji-glyphids, you can use dump-emoji result using that
mapping
…On Tuesday, October 2, 2018, Alisa Patotskaya ***@***.***> wrote:
Hello @ebraminio <https://github.com/ebraminio> ,
Thank you for your response!
Oh, you don't have to. If you glyph id, you can retrieve that glyph like
this https://github.com/harfbuzz/harfbuzz/blob/master/src/hb-
ot-color-svg-table.hh#L118-L119 see "entry.startGlyphID,
entry.endGlyphID)" part, one can write a binary search
How should I get the glyph ID per character if we are talking about vector
font? Does the regular font parsing from harfbuzz work for SVG fonts as
well?
Thanks 👍
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1192 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAy3wVkV42XjPx-QtkPWxoi5uDPP0AIdks5ug29qgaJpZM4W-Wnt>
.
|
Thanks a lot @ebraminio! |
Let us know if anything not clear.
…On Tuesday, October 2, 2018, Alisa Patotskaya ***@***.***> wrote:
Thanks a lot @ebraminio <https://github.com/ebraminio>!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1192 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAy3wQUZNMi8goCbRNVR19fQ-XpE0wrrks5ug6-fgaJpZM4W-Wnt>
.
|
Next version of HarfBuzz will support SVGs publicly, let me know if anything needed. |
@ebraminio Sorry to intrude in this conversation but :
Can we send a SVG file to HarfBuzz ? |
SVG-in-OT is a technique to embed SVG files inside font files for Emojis, the next version of harfbuzz can offer that embedded SVG files access to HarfBuzz library clients, but that is just a small part of the work as clients should render those files for themelves. It will be easy for browsers as they already are able to render those but other clients should incorporate something like librsvg to render those. |
@ebraminio Thank you very much for all information. |
Math is not my area of expertise :)
That is freetype, nothing to do with harfbuzz AFAICS, I guess not |
HarfBuzz does not (currently) do rasterization, and even if it did it is very highly unlikely it will be supporting SVG outlines. You can simply add the stretchy glyph to a font file and use it in your application (directly accessing the font and the glyphs). The above proposed math shaping API is a high level one, but if your application supports OpenType |
@ebraminio @khaledhosny Great thanks a lot for answers and all information.
That why I want to do the same thing but without using a font file. |
I think we are a bit confused on what you want, harfbuzz is not doing any rendering and freetype is where you should have a look, maybe you can pick some parts of their renderer to feed it to your paths. Or maybe https://github.com/behdad/glyphy can help you, who knows :) |
@ebraminio Thanks for suggestions. |
Given my Android experience [not JavaFX], I may have a good suggestion for you, have a look at PathParser, it parses SVG like paths. It translated path data to Android's Path API if you can find something similar on standard Java--I am sure there should be--you can render your SVG like paths by your own also I believe. |
Hello!
I have a question regarding mapping of SVG to UTF character: I need to extract from a font SVG corresponding to a UTF character. In hb-ot-color-svg-table.hh I found the way to load all the SVGs, but that's not particularly what I need, cause it's very memory consuming + there is no understanding between UTFs and SVGs mapping.
Here is a vector emojis font I am using: https://drive.google.com/file/d/1p2Z1WLrbYZX_LWJPD0bXfus27cd4bFqM/view?usp=sharing
Do you have any suggestions?
Thank you in advance.
The text was updated successfully, but these errors were encountered: