Support GPOS kerning table by HarfBuzz - freetype

How can HarfBuzz support GPOS kerning? In my task I use the font Myriad.otf. I try to get kerning information through the function hb_font_get_glyph_kerning_for_direction(....). For TTF fonts it works because it uses TrueType kern tables, but for Myriad.otf it does not work.

Are you planning for applying that kernings manually? If so, that is not the way harfbuzz intended to be used as harfbuzz provides a simple API that provides eventual result from inputs (hb_shape) and if that is not working, it is a harfbuzz or that font bug. If you however really need to extract GPOS kerning, you can consider reading its related tables (hb_face_reference_table) or check how harfbuzz is reading it for its internal use.

Related

Creating Text with different fonts using opengles 2

My project should display graphic overlay on the monitor using opengles2 in linux environment.
Need to display a text in different fonts on the monitor using opengles2. Freetype library can be used for rendering text in different fonts,
But I am not able to find an example program that would use freetype library in opengles2 Linux to render a text in different fonts.
I wouldn't use plain freetype on anything nowadays. It is missing so many opentype/unicode smarts which have been moved to other libraries a long time ago. So it will work on simple latin text, and hit problems on pretty much anything else (including not simple latin text).
You'd properly be better of long term taking a higher-level lib that abstracts all the text bits (freetype, fontconfig, harfbuzz, freebid, etc), such as pango cairo, and plug it on opengl es.
Some links:
https://dthompson.us/font-rendering-in-opengl-with-pango-and-cairo.html
http://emblemparade.net/blog/using-cairo-with-opengl-es/
http://cairographics.org/OpenGL/

How can i block ttf to web use only(not using fontSquirrl)

I have a font(.ttf) that i want to make sure that no one will be able to download it and install it in his/her computer. i know there is an option to upload the font to fontSquirll and check under the advance mode the following Protection: WebOnlyâ„¢ .
but since they share the fonts that were being converted to fontface i do not wish to use it.
Is there any program that can do that same locally?
A WOFF font does exactly that: protect your font from being installed locally. Apart from some older Android browsers, WOFF support is virtually the same as TTF, and there are plenty of easy tools out there to convert your TTF to WOFF.

Default font sizes with wxWidgets on OSX

I've noticed that my wxWidgets application does not follow the native font sizes on OSX. They are typically too big and also the same font size is used for all widgets, which does not seem to be the case by native default.
I've tried to handle this myself by applying fonts to the top level windows. I've used TinkerTool to read the defaults (should be done automatically of course) and create corresponding fonts, for example using wxFont(wxFontInfo(12).FontName("Helvetica") but it does not render the same as other, native applications.
Does anyone know of a good method to handle this?
I don't know of any examples when wxWidgets controls don't use the same fonts as the native controls, please report any occurrences of this as bugs in the wxWidgets Trac, especially if this is using 2.9.4 (old 2.8 versions use Carbon and are hopeless on modern OS X anyhow). But without any concrete examples I can't really help with this.
As for the font sizes, I think you might be looking for wxWindow::SetWindowVariant() which allows to use smaller versions of the controls which is rather common in OS X UI.

Convert CFF fonts into OpenType fonts programmatically

Does anyone have any pointers where I can find extra information on how to create an opentype wrapper around a CFF font?
Currently I have a parser for CFF files so I can get all sorts of information out of it (cmap, glyph names, widths, names etc etc). Given this information I am unable to create an Opentype (truetype format like) wrapper so I can use the font on Windows using GDI; GDI will not load the Opentype font and the only thing I know is that it fails to load the font.
Does anyone know any additional information, validation applications, example code, get additional information why the font does not load from Windows etc etc?
Note: I am looking for information how to do it, not utilities and/or conversion tools.
Until now, I found three libraries you could reference:
FreeType: mainly in the cff package. Its main entry is cff\cffload.c. The library is now on GitHub.
FontForge: fontforge\parsettf.c, still on sf.net.
fonttools: fonttools\cffLib.py, on GitHub.
ots tools: cff.cc on Google Code
In parsettf.c, George Williams wrote that
"TrueType is a really icky format." ...Now that I understand it better it seems better designed, but the docs remain inconsistent. Sometimes badly so.
IMO, the cff spec is just as bad.
Maybe it is better designed. I might eventually look into it to confirm, but it might just be too old to be good.
What old things are good? Parents, math and philosophy :)
Anything else must be up-to-date!
CFF(Compact Font Format) is mainly used for embedded PostScript font in PDF files. And you can also find CFF in OpenType font files which is based on PostScript outlines.
If you got CFF from the embedded font file of a PDF, you can get a PostScript name from the NameIndex of the CFF. You should find the corresponding OpenType File by the PostScript Name.
If you got CFF from a OpenType file, why did you ask this question? :-D
I quote this link: Raster, Vector, TrueType, and OpenType Fonts
... the glyphs for a font are stored in a font-resource file. ...
So, Windows loads glyphs from a file with a format that it understands, not a CFF file, and not a structure from memory. If you want to draw CFF files without using a file conversion tool, I think you will need to load the CFF and draw the glyphs by yourself.
To load the CFF and determine the glyph, you can use the FreeType Project. Here is a link here on SO that explain how to build a Win32 DLL from FreeType source: Compiling FreeType to DLL (as opposed to static library)
To draw the glyphs, you can get some inspiration from the gdipp project, which is a replacement of the Windows text renderer, and contains Win32 C/C++ sample code that display glyphs loaded from FreeType.
It appears that the CFF format was made to be embedded directly into an OpenType file. Microsoft has a good overview of OpenType files: http://www.microsoft.com/typography/otspec/otff.htm

How do I create a container file?

I would like to create a file format for my app like Quake, OO, and MS Office 07 have.
Basically a uncompressed zip folder, or tar file.
I need this to be cross platform (mac and windows).
Can I do something via command prompt and bash?
If you want a single file that is portable to all platforms and which contain structured data, consider using sqlite. You'll get a full featured ACID compliant database that exists on disk as a single file.
There are libraries you can link against to directly access the file, and there is a command line tool you can use as well. No matter what language you are using, most likely there is support for it.
http://www.sqlite.org
Have a look at the open source 7Zip compression format. For your specific needs, you can use it in an "Archive" mode, zero compression but very fast.
It provides a powerful SDK, LZMA, from the site:
"LZMA is the default and general compression method of 7z format in the 7-Zip program. LZMA provides a high compression ratio and very fast decompression, so it is very suitable for embedded applications. For example, it can be used for ROM (firmware) compressing.
The LZMA SDK provides the documentation, samples, header files, libraries, and tools you need to develop applications that use LZMA compression."
Zip is supported everywhere. If a container is all you need, than those are surely good options.
SQLite is great.
A single file, crossplatform, a tiny library, SQL access to data, transactions, the whole enchilada.
you can use transactions to guarantee consistent return points in case of crashing. check uses for sqlite, they specifically advocate using it as a data model layer for desktop applications.
also, there's a command-line tool to manually access the data.
First thing you should ask yourself is, "Do I really need to make my own?"
Depending on what you want to use it for, you are probably better off using a common format and some pre-made libraries which already handle one of those formats very well.
Good places to start:
http://www.destructor.de/libtar/index.htm (tar -- a the 'container' format)
http://www.zlib.net/ (zlib -- a method of compressing data before or after you put it in the container)
If you still really think you need to make your own, I would suggest studying something very simple first, like tar's format:
http://en.wikipedia.org/wiki/Tar_(file_format)
or
http://schmidt.devlib.org/file-formats/tar-archive-file-format.html
Instead of making a format, I'd just decide on a convention. One or more named files within the container have the metadata you need to access the rest of the files, and know what to do with them. The container itself, though, should just be some ubiquitous format, such as zip. No need to reinvent the wheel, here.

Resources