Produce an OpenType font programmatically: request for HOWTO - build

Background: Adobe released their first open source fonts to the GitHub. Repos consist of many files with different syntax, some of them are binary. See e.g. https://github.com/adobe/source-sans-pro
In the corresponding README file, build process is outlined like this:
> Key to building OTF or TTF fonts is makeotf, which is part of the AFDKO toolset.
> In this repository, all necessary files are in place for building the OTF and TTF fonts.
It works, but doesn't contribute to my understanding of the font creation process. I've found specs of some of the formats, but very little about what they do. A good HOWTO would help a lot.
And the main question is, I have glyphs in SVG (or any other vector) format and necessary metrics for each glyph. Let's also say that kerning is a non-issue for now, to keep things simple.
How do I build an OTF (or TTF) font file automatically with those?
I'm comfortable with both programming and reading the f. manuals, just don't know where to begin.

Related

Change pdf files with the Poppler library

Not so long ago I started working with the Poppler library. Learned how to get data from a pdf file. But the question is that I need to modify this file. For example, add a new blank page and save it as a PDF. On the Internet, it is mainly described how to get data, but not make changes to the file.
The OP has recognized there are no creative features in the poppler utilities library (which are a spin off from xpdf utilities)
Xpdf PDF file viewer widget and family do have some modify pdf abilities but as part of a wider suite of QT applications.
Poppler is aligned with Cairo which is designed to produce consistent output on all output media. However editing/altering PDFs is not its aim.
You can use poppler to achieve the requested task in a roundabout fashion, but it's very limited for similar tasks or content editing.
The direct answer to the question is to use poppler to split the source
so for example to add in a blank page 3 into a 3 page source (thus pushing existing page 3 to 4)
pdfseparate.exe -f 1 -l 2 layout.pdf page%d.pdf
pdfseparate.exe -f 3 -l 3 layout.pdf page4.pdf
pdfunite.exe page1.pdf page2.pdf inserted.pdf page4.pdf newlayout.pdf
However this is NOT a recommended method as many similar related issues will be found in Q&A, since the new file is usually bloated by duplicated resources, and much of the internal links in the source suffer collateral damage.
For this task a more dedicated manipulation app is required such as say cpdf

Must I use path to fonts?

The FT_New_Face function seems to be the one I'm looking for, but it requires a path to the font file. I would like to open a font like "Times New Roman," without supplying a path. How can I do that?
Most unix-based systems use Fontconfig for this to get best matching font file from set of search parameters ( family name, variations, weight etc )
Fontconfig is a library for configuring and customizing font access.
Fontconfig can:
discover new fonts when installed automatically, removing a common
source of configuration problems.
perform font name substitution, so that appropriate alternative fonts can be selected if fonts are missing.
identify the set of fonts required to completely cover a set
of languages.
have GUI configuration tools built as it uses an XML-based configuration file (though with autodiscovery, we believe
this need is minimized).
efficiently and quickly find the fonts you
need among the set of fonts you have installed, even if you have
installed thousands of fonts, while minimzing memory usage.
be used in concert with the X Render Extension and FreeType to implement high quality, anti-aliased and subpixel rendered text on a display.
Fontconfig does not:
render the fonts themselves (this is left to FreeType or other
rendering mechanisms)
depend on the X Window System in any fashion, so
that printer only applications do not have such dependencies
Fontconfig is relatively portable and used on a variety of systems, however OSX has CoreText which has similar functionality and Windows has DirectWrite
Refer to this question for help on how to use Fontconfig.

Allegro 5 ALLEGRO_BITMAP to text file

I'm currently working on a video game project in C++ using Allegro 5 as my graphics library. I store my graphic and font assets in subfolders within the root folder of the .exe. To use them in the program, I have an initGraphics() function that loads all the required assets through al_load_bitmap(), and then later free up the memory with al_destroy_bitmap(). This means however that when I eventually distribute my game, it'll be super easy for anyone to go into the install folder and just edit the graphics to be whatever, and I'm having trouble finding any kind of help regarding how to prevent this.
What I was thinking maybe is some kind of program that I'd run on my own computer before distribution that loads the appropriate graphical assets, and somehow converts them into a .txt file, then changing the main game executable's 'initGraphics()' function to load and use those instead of just the raw .png files, but I'm not sure if this is possible. Any information about this type of conversion would be hugely appreciated, or alternatively a more reliable tested method that achieves the same effect. Thank you very much in advance!
While researching the internet I've found interesting solution:
Allegro5 uses PhysicsFS library to handle file archives. It does not support password protected archives, but you can calculate md5 for your assets archive and hardcode it into your program and then compare it on runtime (source - see more here).
See this part of documentation of Allegro5.
Example explanation of md5 implementation is here

Exporting *.png sequence from *.fla with C++

I need an animation in my program. My designer draws animation in Flash and provides me with *.fla file. All I need is to grab 30-40 PNGs from this file and store them within my internal storage.
Is it possible grab resources from *.fla with C++ ? Probably, some Adobe OLE objects can help?
Please, advice.
Thanks in advance.
If I asked an artist to make me an icon I wouldn't expect to need to write code to convert a .3DS model into a usable icon format.
You can save yourself a lot of time and hassle by having your designer use File->Export and give you PNGs of the layers and frames instead of a .FLA file if that's the format you require for your implementation.
If that's not possible for some reason then you can probably find a flash decompiler that has a command line option which you could launch from your program to extract assets as part of your loading sequence but that is generally frowned upon because this is not the intended use of the proprietary format for .swf/.fla anymore than you should design applications to extract source code from a binary executable.
Assuming
You are using CS5
The assets used internally in the FLA are already PNG's as you want them to be.
Then simply get the FLA saved as a XFL file, and you will be able to grab them from the library folder ( but then why not just get them to mail you the pngs ? )
So if for some reason you can only get access to the fla and not the designer, then you can do it programatically by renaming the fla to .zip, extracting.. and you have the XFL format.

SVG decoding - portable solution

I need fully functional vector format, which i can decode to plain bitmap data in my app. It doesn't need to be SVG, but it seemed best (but other suggestions are welcome). So, i need an lib to simply rasterize SVG into plain pixel data - the simplier, the better. The problem is I need it for bada OS (it's OS for mobile phones), so i need to compile it directly with bada IDE. I found librsvg, but it seems it needs linux environment to build, so i can't use it (but i'm not sure, i don't know much about linux - if there is a way to compile it normally, tell me). I also found graphics magick, which would be perfect, but it can't correctly decode the SVG files i need (SVG support is partial). Chrome, Firefox and Inkscape opens those files perfectly. So, what lib can i use for simple rasterization of SVG files? It can be C or C++, needs to be fully open source.
Use Cairo, specifically the cairomm library for C++.