Adam J Wolf: Weekly Xamarin Newsletter Issue #54

Free Xamarin Subscriptions for Windows Phone Developers Joseph Hill, from Xamarin Inc., made all Windows Phone developers day. Accessing Azure AD information from .Net Azure Mobile Services and the Xamarin Client Kevin Ford digs deep into Azure AD and comes up with a winner. Xamarin Helps Launch AWS APN Mobile Competency Program Lacey Butler, from […]

The post Weekly Xamarin Newsletter Issue #54 appeared first on Syntax is my UI.

Details

Johan Karlsson: Roboto Condensed Bold in Forms (iOS)

The last few days have been spent in pixel perfect land. I’ve done some fine tuning of a clients forms layouts that of course includes a bunch of custom fonts. I’ve started out with making sure that the iOS design is correct and we’ll move on to Android and WP in another post perhaps.

This post is about a specific issue and that issue is how the naming of the font isn’t all that matters.

Short version

Ttf-files only contain one weight. If you bold a regular version of a font it will be calculated bold and not the true bold since that one is contained in another file. To get the real bold, you need to reference the ttf-file containing the bold weight.

Start off here for the longer version

To get a grip of how to use custom fonts, please check out the Xamarin documentation at http://developer.xamarin.com/guides/cross-platform/xamarin-forms/working-with/fonts/ and also a post from Mike James that can be found here: https://blog.xamarin.com/custom-fonts-in-ios/

So what’s the problem?

To summarize the usage of custom fonts loaded from a ttf-file on iOS, all described in the links above.

  • Add the ttf-file to the Resource folder – make it a Bundled Resource and Copy Always
  • Edit the info.plist to include the font
And then to use the font we do something like
<Label FontFamily=Roboto Condensed Text=Very custom />

To find out the FontFamily name to use, you open up the ttf-file in Windows by simply double clicking it and you’ll find it. Since my client is a client, they wanted to use a different typeface for the bold text. No problem, I shouted and downloaded the bolder typeface perfectly named Roboto Condensed Bold.

I then opened the ttf file in windows to check out the name and it was named exactly the same. Wait what? How do I then distinguish between them?

It turns out that the Bold font has the same name and will be used if you set FontAttributes=”Bold”.

<Label FontFamily=Roboto Condensed Text=Very custom FontAttributes=Bold />

And if you use the above without importing the “Roboto Condensed Bold” font it will Bold the regular font.

Still, what’s the problem?

Really, nothing when I come to think of it. TrueType only supports one weight per file from what I understand and that’s what I’ve missed in the past. I just thought that a font is a font and all is included within. 🙂
Also, if you only supply the regular weight and bold it, it would be some kind of calculated boldness instead of the real bold font that is meant to be used.

Summary

Make sure you reference all the weights you want and if they have the same name you only have to change the FontAttributes to select the font you wish for. But be careful and check that you actually get the weight you want since it would still bold a regular font instead of picking the correct one if you miss something along the way.

Resources

TrueType on Wikipedia – https://en.wikipedia.org/wiki/TrueType

Details

Xamarin: Mars Petcare Improves Engagement 10x with Xamarin

In 1911, Frank C. Mars made the first Mars candies, establishing Mars’ roots as a confectionery company. The company, based in McLean, Virginia, now has a presence in 74 countries, generating net sales of more than $33 billion a year. Mars Petcare, one of the company’s six lines of business, is headquartered in Brussels, Belgium, […]

The post Mars Petcare Improves Engagement 10x with Xamarin appeared first on Xamarin Blog.

Details

James Montemagno: Motz Codes Live!

When I am not traveling around presenting at conferences, dev days, user groups, and code camps you will probably find me doing one of three things: Riding my bike, drinking coffee, and most likely coding. The elusive Motz can be found coding usually from home or in a coffee shop drinking said coffe, but I have finally decided to unleash my coding to the world in a new web series I am calling “Motz Codes Live”.

Each week I will be covering a topic of mobile development and for about 30-60 mintues I will be coding live, answer questions, and showing you exactly how I code on a daily basis.

Last week I kicked things off by covering how to create your very first Xamarin.UITest test and ship your app to Xamarin Test Cloud all in under 60 minutes. If you weren’t able to see it live the best part is all Motz Codes Live episodes are recorded! Here is the first one:

This Friday I will be covering the topic of using local storage with SQLite-net PCL in your apps. You can subsribe to my Youtube station for the latest updates. Be sure to register here on google hangouts.

Be sure to follow my Google+ or Twitter account for new episodes.

Details