Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I define my CSS to display 'HelveticaNeue-Light' using Pixate Framework?

Clearification! This question is about the iOS framework Pixate (http://www.pixate.com), and not regular CSS inside of a UIWebView.

Code in default.css :

.title {
 font-family: 'Helvetica Neue';
 font-weight: light;
 font-size: 30px;
 color: #005284;

}

Code in view:

UILabel *label = [UILabel new];
label.styleClass = @"title";

Result when logging:

<UICTFont: 0x10d09e210> font-family: "HelveticaNeue-UltraLight"; font-weight: normal; font-style: normal; font-size: 30.00pt

When I try font-weight: medium; I get HelveticaNeue-Medium
When I try font-weight: 300; I get HelveticaNeue-UltraLight
When I try font-weight: 400; I get Helvetica Neue
When I try font-family: 'HelveticaNeue-Light'; I get .HelveticaNeueInterface-M3 ??? (I guess this is the default system font)

If I set the font through code with

label.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:30];

It looks as it should, (and the log says HelveticaNeue-Light)

Here a screenshot. The one of the left is when using code, and the one on the right is when using Pixate with `font-family: 'HelveticaNeue-Light'

enter image description here

How do I get 'HelveticaNeue-Light' (like the one on the left in the screenshot above) using Pixate CSS ?

like image 322
bobmoff Avatar asked Feb 08 '14 10:02

bobmoff


2 Answers

This works on Mavericks and my iOS 7 simulator. Don't know about others.

.title {
    font-family: 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;
    font-size: 30px;
    color: #005284;
}

Here is my test code:

<html>
<head>
<style>
.first {
    font-family: 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;
    font-size: 30px;
    color: #005284;
}
.second {
    font-family: 'Helvetica';
    font-size: 30px;
    color: #005284;
}
</style>
</head>
<div class="first">Hello, World!</div>
<div class="second">Hello, World!</div>
</html>

And the result in Safari http://s.swic.name/TpEP

like image 139
Maciej Swic Avatar answered Nov 01 '22 11:11

Maciej Swic


You found a bug in Pixate and it has been fixed for Pixate Framework 2.1.

like image 42
pixatepaul Avatar answered Nov 01 '22 12:11

pixatepaul