Are cross-platform PNG-in-OTF fonts possible efficiently? - png

The most recent version of the Opentype font format (1.8 as of late 2016) standardizes two different tables to embed PNG bitmap data: Google’s CBDT (together with CBLC) and Apple’s sbix. Furthermore, the SVGs in Mozilla’s SVG  table can also embed or reference PNGs.
Is it possible to embed the PNG chunks once and use them in at least two tables to make cross-platform emoji font files that are not bigger than necessary?
Side question: can PNG chunks be reused for multiple glyphs, e.g. indexed color palettes?
PS: I know that Apple’s operating systems override emojis with those from a font which has the PS name AppleColorEmoji.

You can't share images across tables, e.g. use PNG images in the sbix table in the cbdt table. But if you use the exact same image files they might be "deduped" in a compressed WOFF.
Weird thing is that the CBDT/CBLC spec says a glyf table shouldn't be present, while the other formats require it. So you can't put cbdt alongside an sbix or svg table in a font. But you could combine the latter two to get relatively good support on Windows and OSX.

Related

how to generate a pdf with pdfbox which should contains latin/asian/arbian charaters in the same page?

I try since few days to produce a new pdf file with pdfbox from a data extraction which contains values with different fonts. I have mainly latin characters but some names in my list of strings are in chinese or cyrillic, etc, characters.
I have spent lots of time and energy on google or stackoverflow but still don t manage to produce it(glyphe issue).
Currently, I m on Windows but will be deployed on Linux, and I use the version 2.0.26 or 3.0.0-RC1 of pdfbox.
I m manage to load ttf like that:
PDType0Font.load(doc, File("src/main/resources/font/LiberationSans-Regular.ttf").inputStream(),false)
if I set true to embedded in any cases, I got an issue of cmap.
I also tried to load ttc files but failed each time.
I have already started to implement this solution link but I don t manage to init/load correctly my font
Do you have any idea to do it?
Best, Mat

Swift: Unicode transformations: How to generate a rainbow infinity symbol

In xcode, developing for iOS "\u{1F3F3}\u{FE0F}\u{200D}\u{1F308}" is a rainbow flag.
"\u{1F3F3}" is a white flag, and "\u{1F308}" is a rainbow. The middle symbols "\u{FE0F}\u{200D}" are invisible symbols used to join these two together to make the rainbow flag symbol.
I am trying to combine unicode characters to make a rainbow infinity symbol, but not exactly sure how to implement this.
Not sure if there is an already existing unicode character or apple api I can use to do this, but would appreciate learning how to do this
I wouldn't mind having an infinity symbol over the rainbow flag either (like the apple anti-lgbt flag incident) as an alternative.
Emoji fonts are still just fonts. If they don’t contain a specific glyph, then they cannot display that glyph. The reason “🏳️‍🌈” looks like a rainbow flag is because someone drew a picture of a rainbow flag and then defined their font in such a way that the sequence <U+1F3F3, U+FE0F, U+200D, U+1F308> would be displayed using that specific image. Much like how someone first had to define the precise shape of the letter “A” in their font and then apply that glyph to the codepoint U+0041.
There is no image-rendering code that instinctively knows how to apply the colours of 🌈 to the shape of 🏳️ and then automatically generates a new glyph on the fly. It’s all explicitly pre-defined.
U+200D is the so-called Zero Width Joiner (ZWJ), so emoji sequences using that character are appropriately named Zero Width Joiner Sequences. They were originally invented by Apple to support emoji that weren’t part of the Unicode standard (in particular, variants of 💏, 💑, and 👪️ with different gender configurations), but later other vendors jumped on board as well and nowadays they are officially part of Unicode as an alternative way for defining new emoji without having to encode entirely new characters. Currently, about a third of all officially recommended emoji are ZWJ sequences.
In theory, any person can make up their own ZWJ sequences just by joining existing characters together (as was their original intent). In your case, “♾️+ZWJ+🌈” or <U+267E, U+FE0F, U+200D, U+1F308> would be an obvious sequence for a rainbow-coloured infinity symbol. You just have to create your own font containing the glyph you want, and then distribute that font to other people so that they can see the same glyph as you. There are just a few problems:
Making fonts with colourful glyphs is not easy. I couldn’t tell you whether there even exist freely available tools for that task.
There are four different formats for emoji fonts (used by Apple, Google, Microsoft, and Mozilla respectively) and they generally do not work on each other’s platforms, so you would need to create not just one, but several fonts unless you don’t care about people on other operating systems.
Installing your own fonts is not possible on most mobile phones, so your custom emoji would mostly only be available to desktop users.

freetype how to handle (compose) long strings of complex scripts

I use freetype to render single characters, I can use some additional data to create long strings. But for complex scripts of languages like Hindi or Tibetan you need an advanced logic that will connect all those subscripts, superscripts, complex consonants etc. How is that supposed to be handled? Is there a library on top of freetype or there are functions inside freetype that I cannot locate?
Actually it's OT on SO to ask for/recommend libraries, but I think the only open source choice is Pango:
Pango is a library for laying out and rendering of text, with an emphasis on internationalization."
[...]
Pango includes PangoLayout, a high level driver for laying out entire blocks of text, and routines to assist in editing internationalized text.
See the Script Gallery for a selection of European and other scripts that it can handle -- I don't see Hindi (Devanagari) or Tibetan, but it seems highly likely it has no problems with either.
Pango internally uses "Harfbuzz for complex-text handling". You could try both, and see how much work is required to get what you need using Harfbuzz alone, or go straight to Pango and get the all-inclusive package. (I wonder where to draw a dividing line in the functionality.)
FYI: part of the "advanced logic" that FreeType lacks can be attributed to handling OpenType positioning and glyph replacement. The FreeType developers appear to have concentrated primarily on drawing glyphs (see http://freetype.org/opentype/index.html), out-sourcing the logistics to Harfbuzz.

How to convert unicode font to ansi

I am trying to use bengali writing product AVRO but since it uses UNICODE by default so working with ADOBE products like photoshop, pagemaker, etc. are not working at all. When i change the mode to ANSI then AVRO works but i also have to change the font to ANSI coded font(unicoded fonts dont work). Now it will be very kind if someone find any one of them -
1) Collection of Bengali ANSI coded fonts.
or
2) Method to convert these UNICODE fonts to ANSI fonts(if its possible, I dont know actually)
or
3) A workaround to use them on Adobe products and still using the unicoded fonts.
There are numerous software like Indica, Ramdhenu, Easy DTP etc. to type in Pagemaker, Photoshop, coreldraw etc. I use and prefer Indica.

Where to get a reference image for any unicode code point?

I am looking for an online service (or collection of images) that can return an image for any unicode code point.
Unicode.org does not have an image for each one, consider for example
http://www.unicode.org/cgi-bin/GetUnihanData.pl?codepoint=31cf
EDIT: I need to use these images programmatically, so the code chart PDFs provided at unicode.org are not useful.
The images in the PDF are copyrighted, so there are legal issues around extracting them. (I am not a lawyer.) I suspect that those legal issues prevent a simple solution from being provided, unless someone wants to go to the trouble of drawing all of those images. It might happen, but seems unlikely.
Your best bet is to download a selection of fonts that collectively cover the entire range of characters, and display the characters using those fonts. There are two difficulties with this approach: combining characters and invisible characters.
The combining characters can easily be detected from the Unicode database, and you can supply a base character (such as NBSP) to use for displaying them. (There is a special code point intended for this purpose, but I can't find it at the moment.)
Invisible characters could be displayed with a dotted square box containing the abbreviation for the character. Those you may have to locate manually and construct the necessary abbreviations. I am not aware of any shortcuts for that.