I have created a studio for user to create different type of logos. It also contains a couple of labels. I want to allow the user to convert those label font to bold and italic but I am having an issue that the fonts I am using dont have either Italic or Bold in their families. I tried a couple of solutions which contains:
UIFontDescriptor * fontD = [font.fontDescriptor
fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitBold];
selectedLabel.font = [UIFont fontWithDescriptor:fontD size:0];
but this changes my font to system font as no bold or italic font is found to it.
For Bold, I added some stroke so the font looks like bold which is ofcourse a bad practice but then again I got stuck for Italic. Is there any proper way that I can allow those fonts to be converted to Bold and Italic without having bold or italic in their family ?
Fonts I am using Aaargh, Average Sans, Cardinal, Comfortaa and others.
Related
My script changes text in a text layer, but doing that changes the text from italic to normal text. Is there a way to not make it change; or to change it back afterwards?
I looked in the command browser in gimp but only found commands to change the font itself. I couldn't find a way to pass any additional formatting, but maybe I missed something.. Any ideas?
Gimp has no notion of "Italic" or "Bold" font attributes. Fonts usually have several variants that appear "italic" (such as Latin Modern Sans Oblique or Latin Modern Roman Slanted) or "bold" with various degrees (Noto Sans goes form Noto Sans Thin to Noto Sans Heavy, with intermediate Semi-bold,Bold, and Ultra-bold variants. But it's all in the name.
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
If I run this code (on the iPhone):
NSArray *names = [UIFont familyNames];
NSLog(#"Font FamilyNames");
for (NSString *name in names) {
NSLog(#"Font Family: %#",name);
NSArray *fontFaces = [UIFont fontNamesForFamilyName:name];
for (NSString *fname in fontFaces) {
NSLog(#" %#",fname);
}
}
I get this output (abridged):
...
Font Family: Georgia
Georgia-BoldItalic
Georgia-Bold
Georgia-Italic
Georgia
Font Family: Helvetica Neue
HelveticaNeue-BoldItalic
HelveticaNeue-Light
HelveticaNeue-Italic
HelveticaNeue-UltraLightItalic
HelveticaNeue-CondensedBold
HelveticaNeue-MediumItalic
HelveticaNeue-Thin
HelveticaNeue-Medium
HelveticaNeue-ThinItalic
HelveticaNeue-LightItalic
HelveticaNeue-UltraLight
HelveticaNeue-Bold
HelveticaNeue
HelveticaNeue-CondensedBlack
Font Family: Gill Sans
GillSans
GillSans-Italic
...
You can see that each font family has various fonts, but the font names are anything but user-friendly. For example, TextEdit presents them in a much better way:
How can I in a stable way (meaning it works on all fonts, even fonts not yet available on iOS) get the names for each font like TextEdit?
The only thing that comes to mind is to parse each font face name, turning HelveticaNeue-CondensedBold into Condensed Bold and HelveticaNeue-UltraLightItalic into Ultra Light Italic. However, you'll notice that TextEdit presents HelveticaNeue-UltraLightItalic as UltraLight Italic, not Ultra Light Italic and I'm not sure this method works for all fonts...
Examples of fonts that would not work well with my idea:
Font Family: Bodoni 72
BodoniSvtyTwoITCTT-Book
BodoniSvtyTwoITCTT-Bold
BodoniSvtyTwoITCTT-BookIta
(Bodoni 72 != BodoniSvtyTwoITCTT)
Font Family: Times New Roman
TimesNewRomanPS-BoldItalicMT
TimesNewRomanPSMT
TimesNewRomanPS-BoldMT
TimesNewRomanPS-ItalicMT
(Times New Roman != TimesNewRomanPS and what's up with that MT?)
Other problem with it: No font face name contains Regular, but that is what users expect to see in the options (see the TextEdit screenshot).
HelveticaNeue (Without - Anything)= Regular.
MT = Monotype
See: http://www.fonts.com/support/faq/lt-mt-ef-abbreviations
How to use fonts that are not available on iOS as default?
You will need to config your PList
Drag the font files into your resource folder
Then you can use the new custom font like below code:-
[self.activateBtn.titleLabel setFont:
[UIFont fontWithName:#"ProximaNova-Regular" size:15]];
For more information, you may visit:
Use custom fonts in iPhone App
I'm trying to reduce the weight of font in UILabel text.
I'm using Helvetica font, still i want the text more thinner.
how can i reduce the thickness of UILabel text font weight?
You can set the font to a different variant in the same family, for instance Helvetica-Light (where by default you get Helvetica-Regular). iosfonts.com provide a nice site for viewing font options.
You can't set an arbitrary weight for any font. Some fonts have a bold and regular variant. A smaller number also have a "light" variant. As the other poster said, if the font is one of those that has a light variant, you can select that, but you can't arbitrarily reduce the weight of a font.
You need to reduce the pointSize of the UIFont used by the UILabel:
UILabel *label; // Your Label
UIFont *font = label.font;
label.font = [font fontWithSize:(font.pointSize - 4)];
This example reduces the font by 4 points.
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