fritzing / fritzing-app

Fritzing desktop application
http://fritzing.org
Other
3.98k stars 826 forks source link

We are now packaging some fonts with the app. What next? #352

Closed davidperrenoud closed 10 years ago

davidperrenoud commented 10 years ago

From dirk.van...@gmail.com on December 07, 2008 10:26:56

Just as a reminder that we need to find out how to do this.

Fritzing is using a couple of fonts, e.g. the fonts being used on parts, or the fonts for the labels. They need to be shipped inside Fritzing, so we can use them in the application. If they are bundled as binaries inside the app, there should be no problem with copyright and distribution items.

We are currently using: TheSans, the FHP, modified version (which we, as FHP, have a licence for) OCR A Std, used for silkscreen layer (is public domain) 04b11, a bitmap-like font, we use that as label on some parts (is a free font)

Original issue: http://code.google.com/p/fritzing/issues/detail?id=352

davidperrenoud commented 10 years ago

From irasc...@gmail.com on January 09, 2009 06:44:24

Probably requires us to ship Fritzing with an installer; I haven't been able to find any direct Qt support caching/installing fonts. Another way to go would be to save a font as a resource in Fritzing, and then use platform-dependent code to install it.

davidperrenoud commented 10 years ago

From dirk.van...@gmail.com on January 09, 2009 11:18:46

Note that even though the font might be installed on the machine, it is not recognized by Fritzing. That is, a svg file with contains text, which is set to a particular fonts isn't correctly displayed in Fritzing. The same svg, including the text looks fine when viewed with another application, e.g. Firefox. So besides the font needing to be installed, Fritzing should also be told about its existence.

Note that there might also be additional issues with installation of fonts by Fritzing. Like it shouldn't overwrite fonts files with the same name which the user installed themselves. And I don't know if we can freely distribute every font we want eventhough we might have the licence to use it ourselves (if we pack the font within the binary of our application we won't have those problems)

davidperrenoud commented 10 years ago

From irasc...@gmail.com on February 23, 2009 06:02:23

changing the owner: Brendan and Mariano did some experimentation with svg fonts in qt, but ran into some difficulties: please describe how far you got.

Owner: brendan.howell

davidperrenoud commented 10 years ago

From brendan....@gmail.com on March 03, 2009 07:28:21

For more info and some back-and-forth about copyright, see here: http://groups.google.com/group/fritzing/browse_thread/thread/ef857e9b8b2a99a/a118f4874dadc148?lnk=gst&q=svg#a118f4874dadc148 to summarize our results. We found some tools to convert fonts to SVG shapes. They work. We can also embed fonts in SVGs and they work in Firefox but Qt's SVG implementation just does not seem to like using alternative glyphs weather they are in the same file or externally referenced. Then again we only spent about 45 minutes messing with it before giving up. It could be that our xpath references were somehow wrong (despite following examples almost exactly).

It might be worth asking the Qt folks about this as it would solve these font problems for parts as well as make those fields editable (potentially in the parts editor).

davidperrenoud commented 10 years ago

From meru...@gmail.com on March 03, 2009 07:35:28

we followed the examples in this spec: http://www.w3.org/TR/SVGTiny12/fonts.html

davidperrenoud commented 10 years ago

From irasc...@gmail.com on March 04, 2009 02:19:18

from the Qt 4.5 change log:

( http://www.qtsoftware.com/developer/changes/changes-4.5.0 )

which seems to imply they can deal with embedded SVG-fonts

davidperrenoud commented 10 years ago

From meru...@gmail.com on March 06, 2009 10:53:22

tried with almost all the svg viewers around, and so far, the only one that renders the embedded fonts, is opera

here is the link that enlightened us: http://frankbruder.fr.ohost.de/fonts/svgfontshowto_en.xhtml qt svg render does NOT support embedded fonts

Attachment: font03.svg

davidperrenoud commented 10 years ago

From meru...@gmail.com on March 06, 2009 11:03:41

sorry, wrong file

Attachment: font01.svg

davidperrenoud commented 10 years ago

From meru...@gmail.com on March 06, 2009 11:13:13

qtWebKit DOES render font01.svg

davidperrenoud commented 10 years ago

From irasc...@gmail.com on March 07, 2009 07:40:13

It turns out there may be a way to package fonts directly--we could embed fonts as resources or include them as separate files as part of the Fritzing package.

There is a Qt class called QFontDatabase which has a function called addApplicationFont() which takes a font filename as a parameter. The font must be a true-type font.

The only reason I'm not completely certain this will work is because there is a note about linux/x11 and I don't know whether it's a showstopper: "Adding application fonts on Unix/X11 platforms without fontconfig is currently not supported." Brendan, Mariano?

I have tested that this works under WinXP using Qt 4.5.0. I went to the following site: http://www.thibault.org/fonts/isabella/ , downloaded the true-type Isabella zip for windows, and extracted it to a local folder. Then I hacked note.cpp so that it would add that application font, and would use that font in the note.

I will check in that version of note.cpp with the hacked bit in comments, so you can uncomment it and try hacking it for your platform. There are two commented areas and they're both in the constructor for the note class.

davidperrenoud commented 10 years ago

From meru...@gmail.com on March 09, 2009 06:50:50

i tried this hack, and it works the fontconfig package is quite a standard (for example, if you want to use firefox, you need it). But we can also pack it inside the linux version

davidperrenoud commented 10 years ago

From andre.knoerig@gmail.com on April 09, 2009 07:47:45

Good fonts for this, all GPL and optimized for screen rendering: http://en.wikipedia.org/wiki/Droid_(font) from Google Android http://en.wikipedia.org/wiki/OCR-A_font especially good for IC labels http://en.wikipedia.org/wiki/Bitstream_Vera

Cc: johannes.landstorfer
Labels: -Type-Defect Type-Enhancement Component-GUI Component-PDK

davidperrenoud commented 10 years ago

From irasc...@gmail.com on June 22, 2009 22:21:54

r3179 : The droid font (sans and sans-bold), and OCR-A10 are now included as resources in the fritzing binary. I have downloaded the bitstream vera fonts, but there are "four monospace and sans faces (normal, oblique, bold, bold oblique) and two serif faces (normal and bold)". Which of these faces need to be added?

After that, do all the SVGs with a "font-family" style attribute need to be updated to use the fonts that travel with Fritzing?

Finally, there is a droid fallback font which contains a Chinese character set.
However it's 3 megs. Do we need to include this font for notes, or make it optional, or...?

Changing the summary to reflect current status.

Summary: We are now packaging some fonts with the app. What next?
Cc: andre.knoerig

davidperrenoud commented 10 years ago

From andre.knoerig@gmail.com on June 23, 2009 02:52:34

Yippee! The Bitstream Vera is not necessary, it was just meant as an alternative to Droid.

We now need to update all parts to use fonts instead of vector outlines, and then add some kind of support in the parts editor. I'll open new issues for that.

Status: Fixed