I can get sIFR to work but it will only display the bold version of the font I have exported. I checked the report and it seems to be stripping out any font weight that is not bolded in flash. I exported two different files to test, the first with regular and bold and the second with medium and semibold in both cases only the bolded weights were exported. Any ideas on how to fix this?
When exporting the Flash movie, make sure at least one character in the text field has the styles applied to it. Then it should export fine.
I had a similar problem - could not make the font 'bold' style work, and I even whanted my fonts BlackItalic to work. Messing around and reading your post and Marks answer made me try to apply the BlackItalic style to the very first word in the provided fla file. Keeping the css style 'font-weight: normal;' in the config java code was successful!
Until I read some new posts about this I will follow the work flow making individual swf files for every font style - normally I only want to use one or to styles anyway.
Related
I can happily use jspdf to add fonts to a pdf. For that so far I add a font for regular, one for italic, one for bold and one for bolditalic in my case.
Now I have some fonts that do not provide these different fonts but variable ttf-fonts and I struggle to use those with JSPDF.
So far my solution goes like this:
pdf.addFileToVFS(`${fontFamily}-bold.ttf`, fontBase64Data);
pdf.addFont(`${fontFamily.ttf}-bold.ttf, fontFamily, 'bold', 700);
where I read fontBase64 data from file (which works nicely for regaulr, italic etc) and do the same with the regular and italic fonts...
For variable fonts I tried to add a font with variable font weight with above code just use the fontBase64Data as I read it from the ttf file of variable font.
However that just leaves the font regular.
To my understanding that alos makes sense as the API of addFonts seems to associate a loaded font with a font weight it represents, but does not seem to apply a font weight to the font.
Since I want to use variable fonts however I seem to need to either
set a font as variable font, so weight would be automatically applied
apply a weight to the variable font via api and then define that as bold
So far I couldn't find any of that. Am I missing sth or are variable font weights currently not supported yet by jspdf?
Cheers
Tom
I have a master image which I edit in gimp to get the look and feel wanted. I then want to use a python script to produce a bunch of new images with the text (on several different layers) changed. I would like to leave the font, size, italicized or not, etc. alone.
I've successfully changed the text in my batch script with this function:
pdb.gimp_text_layer_set_text(layer, text)
The problem is this also overwrites the font and other text parameters that I had picked out in the master file. Is there a way to change just the text and leave the font alone?
Alternately, a more clunky way would be to try and save everything important about the font before the change and try to reapply it. This is what I've tried:
# Find the text layer
text1_layer = filter(lambda x: x.name == 'text1', im.layers)[0]
# Save the font
font = pdb.gimp_text_layer_get_font(text1_layer)
font_size, font_unit = pdb.gimp_text_layer_get_font_size(text1_layer)
# Set the text
pdb.gimp_text_layer_set_text(text1_layer, tex1_text)
# Restore the font
pdb.gimp_text_layer_set_font(text1_layer, font)
pdb.gimp_text_layer_set_font_size(text1_layer, font_size, font_unit)
Unfortunately, that doesn't seem to work consistently. It looks like the get_font and get_font_size commands retrieve the right font for one of the layers, but not for the others. It doesn't seem to preserve italics etc., and I wouldn't expect it to preserve whether or not text is underlined.
A third option would be to hard code in the font. I would need to go through all the text fields, figure out what the font parameters are and hard code them in for each one. Then, if I redesign the master file (which I will do a lot), I have to repeat the process. This shouldn't be necessary.
I've done a bit more research and found a solution that works for me in gimp, however, it sounds like you should probably be using something other than gimp, such as imagemagick, if you're doing much text editing from a script.
The solution is, when you change text in the gimp editor you need to change the font in the tool dialog box, so it's set as a property of the layer, instead of just selecting the text and changing the font in the floating font box that shows up - that changes the font of the text you selected, but leaves the base font of the text layer unchanged.
In turns out that gimp text functionality is pretty poor, and there are lots of complaints surrounding issues like this online. There is some hope for the future. Apparently gimp supports a markup language for text. You can get the markup for your text this way:
pdb.gimp_text_layer_get_markup(layer)
Unfortunately, there is no set_markup function - even though it's been commented on and requested for 3-5 years now, so don't hold your breath. If such a function existed, then the get_markup and set_markup functions would give a script complete control over text. It doesn't exist, however, so if you want to change pieces of text (eg. to add italics to a word), you have to create separate layers. If all your text is to be formatted the same, you can edit it via script or editor, and as long as you set it in the text layer properties (done via the tool box in the editor, and the only way you can change font in a script), then the set_text function in a script will maintain font, etc.
https://bugzilla.gnome.org/show_bug.cgi?id=724101
http://gimpchat.com/viewtopic.php?f=9&t=10101&p=132782&hilit=change+text+markup#p132782
Not really a satisfactory answer, but too big to post as a comment.
Yes, the text layer API wasn't updated to follow the new capabilities. Actually all the info is in a gimp-text-layer "parasite":
parasites=layer.parasite_list()
if parasites and 'gimp-text-layer' in parasites:
data=layer.parasite_find('gimp-text-layer').data
pdb.gimp_message('Text layer "%s": %s' % (layer.name,data))
This parasite doesn't seem to exist until the image has been saved at least once.
However, even though you can replace the parasite data, it doesn't change the text layer, and to make it worse, it seems that Gimp detects the change, assumes that the layer text data is corrupt, and makes the layer a plain bitmap when saving the image.
Now, poring over the source code, there are mentions of a GDynText plugin that you can find on SourceForge and that advertizes itself as:
GIMP Dynamic Text is a GIMP plug-in that works like the text tool but allows you writing multi-line text and made you able of modifying it later as you want (text/font/font size/color/...).
So you could be lucky, or not...
I am trying to place an overarrow over a piece of text in MathJax.
I am using a custom font that I declare in the code-
\(\overrightarrow{\style{font-family: mysans, TeX, Arial, sans-serif;}{\text{" + tString + "}}}\)"
It works ok for most letters- for capital W or M , using a couple in a row like "WWW" the overbar is too short.
For lowercase i , using a couple in a row, ie "iii" it is too long. My hunch is that MathJax is using a standard character width size to figure out the length of the overarrow and when the character is much longer or shorter than that size, it calculates the overarrow incorrectly. Is there any way around this?
Thanks!
First off, you generally cannot use custom fonts with MathJax. As the documentation says
Since browsers do not provide APIs to access font metrics, MathJax has to ship with the necessary font data; this font data is generated during development and cannot be generated on the fly. In addition, most fonts do not cover the relevant characters for mathematical layout. Finally, some fonts (e.g. Cambria Math) store important glyphs outside the Unicode range, making them inaccessible to JavaScript.
However, if you are only looking to use custom fonts in text elements, then there is a way to work around this: style the surrounding context and set mtextFontInherit:true for the output jax, cf. e.g. here for HTML-CSS.
Unfortunately, this won't actually help you right now. There's a minor regression in MathJax 2.5 (see this discussion leading to the result you describe). This will be fixed in 2.5.1 and in the mean time you could set noReflows:false for the HTML-CSS output.
I'm trying to put together a LaTeX color box. The xcolor package \fcolorbox seem to be what I want, but I can't get the rendering quite correct. When I use
\fcolorbox{black}{red}{}
it renders a small box sunken to the bottom of the text line. The best I've managed to do is to fake it with a similar text color:
\fcolorbox{black}{red}{\textcolor{red}{--}}
However, I'm worried that this won't render correctly in all situations with defined colors. Is there a way I can declare an empty text box with full in-line text height? Is there another solution?
I'm basically looking for the code that produces the color boxes all through the document at ftp://ftp.dante.de/pub/tex/macros/latex/contrib/xcolor/xcolor.pdf. The boxes I'm referring to are used throughout, but the first instance is on page 4. Thanks.
The xcolor.dtx file in the same directory as the pdf contains the source for the package and the source for the documentation. The relevant bits from the source for the documentation:
\def\testclr#1#{\#testclr{#1}}
\def\#testclr#1#2{{\fboxsep\z#\fbox{\colorbox#1{#2}{\phantom{XX}}}}}
...
(Answer: 40\% \testclr{green} $+$ 60\% \testclr{yellow} $=$ \testclr{green!40!yellow}, e.g., |\color{green!40!yellow}|)
Basically, use \phantom{} on the contents of your color box, and make sure that at least one of the phantom characters is full-height.
Also, https://tex.stackexchange.com/
I have a font which only has a regular weight… I’d like to use another font as the bold weight and another as the italic weight… and have sifr use the extra fonts as a replacement based on strong and or b tags
I’ve tried embedding the multiple fonts in the .swf but only the regular weight get’s applied when sifr is activated. If I have two separate .swf font files I can the text to generate in either font but can't seem to apply the bold version to the bold text in the sentence.
Is their a smarter way to do this? using sifr3 - r436 with CS3 Flash Professional to create the font files
Okay after an hour os do googling various terms I found this
http://discuss.joyent.com/viewtopic.php?id=24567
which answers my question - I now have the whole family embedded as I need
Thanks
R