eker-huang / mathmlformula

Automatically exported from code.google.com/p/mathmlformula
0 stars 0 forks source link

How to embed fmath fonts? #70

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Instead of having the fontswf dir next to my application's swf, I'd like to 
embed the few font swf files I actually need inside my own swf.

What should I do so that fmath can use them, and not try to load the external 
files?

There is a public function addEmbedFont() in the FontManager class.
Can it be of any help for my purpose?
How does it work? What is its expected argument?

If there is a way to do that, can someone give me a quick sample?

Thanks!

(Is there some documentation of the lib's public API? I can't seem to find it.)

Original issue reported on code.google.com by prous...@gmail.com on 8 Feb 2013 at 2:25

GoogleCodeExporter commented 8 years ago
Hi, 

The method addEmbedFont can be used when you have embeded the font and tell to 
the compoenent: This font is emebeded.

Ex: FontManager.addEmbedFont("MyArial").
When you use mathvariant="MyArial" the component knows the font "MyArial" is 
already embeded.

This is for integration in a Flash/Flex app.

Original comment by ionel.alexandru@gmail.com on 8 Feb 2013 at 4:59

GoogleCodeExporter commented 8 years ago
Ok, that's interesting.

So if I call FontManager.addEmbedFont("myFont")

then I only need to make sure flash has loaded a font called "myFont" that has 
all the glyphs I use?

What would be the easiest way to embed one of the fmath fonts as "myFont"?

Or do I need to find a ttf font somewhere else?

Original comment by prous...@gmail.com on 8 Feb 2013 at 5:48

GoogleCodeExporter commented 8 years ago
myFont - is your font (ttf or otf), you emebed yourself in your app.

Original comment by ionel.alexandru@gmail.com on 8 Feb 2013 at 7:05

GoogleCodeExporter commented 8 years ago
I tried that, and it seems to work.

I just have one problem :
I have two font files, one for regular, one for italic.
I embeded both, using the same font name, and called addEmbedFont() with that 
name.

But now in the rendered equations, chars that should be in italic are using the 
regular font instead.

What should I do to have the italics work properly?

Original comment by prous...@gmail.com on 12 Feb 2013 at 1:04

GoogleCodeExporter commented 8 years ago
the name for italic must be "myFont-italic".
try that.

Original comment by ionel.alexandru@gmail.com on 12 Feb 2013 at 2:16

GoogleCodeExporter commented 8 years ago
I doesn't seem to work.

I embed font with :

[Embed(
    source="assets/fonts/STIXGeneral-Regular.otf",
    fontName="stix",
    mimeType="application/x-font",
    advancedAntiAliasing="true",
    fontWeight="normal",
    fontStyle="normal",
    embedAsCFF="false",
    unicodeRange="U+0020-00FF,U+2070-209F,U+2200-22FF"
)]
private var stixRegular : Class;

[Embed(
    source="assets/fonts/STIXGeneral-Italic.otf",
    fontName="stix-italic",
    mimeType="application/x-font",
    advancedAntiAliasing="true",
    fontWeight="normal",
    fontStyle="italic",
    embedAsCFF="false",
    unicodeRange="U+0020-00FF,U+2070-209F,U+2200-22FF"
)]
private var stixItalic : Class;

And then I use :

style.mathvariant = "stix";

And no italics are displayed.

(I also don't call addEmbedFont() at all, I tried to call addEmbedFont("stix") 
but then nothing gets displayed)

Do you see anything wrong?

Original comment by prous...@gmail.com on 12 Feb 2013 at 2:33

GoogleCodeExporter commented 8 years ago
what is your mathml ?

Original comment by ionel.alexandru@gmail.com on 12 Feb 2013 at 4:30

GoogleCodeExporter commented 8 years ago

Original comment by ionel.alexandru@gmail.com on 20 Nov 2014 at 4:20