tolo / InterfaCSS

The CSS-inspired styling and layout framework for iOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question & Feature Request: Using system font (iOS)

SeanAHI opened this issue · comments

Environment: iOS 12.1.* , Xcode 10.1

Question: How do I use the iOS system font in the .css file reference font: ...;?

San Francisco font is the default iOS font. It is not accessible via name reference and needs to be installed as a resource to use and reference. This is not convenient and feels a little over the top to simply reference the default system font with a weight and size.

Normally a reference to the font name like font: AvenirNext-Regular 15 would be how to set the font for a label. However, using font: System-Regular 15 or font: SystemFont-Regular 15 returns the following error message:

InterfaCSS: ISSPropertyDeclaration[font] - Unable to set value on <UILabel...

This also causes a crash on attributed strings as the font is nil which is not permitted in arrays or dictionaries.

Two feature requests:

  1. There is an unknown property resolution in place for UIColor. Consider implementing a resolution for ISSPropertyDeclaration[font] - Unable to set value ... by returning the system font with passed in parameters of size and weight. Example:

if (!font) { return [UIFont systemFontOfSize:size weight:weight]; }

  1. Open up setting of the font size and font weight without declaring the font name Example:

/* fontName: FontName; (string) */ fontWeight: bold; // (enum) fontSize: 17; // (integer)

Any assistance in the interim would be greatly appreciated.

Hi, thanks for the feedback. This is actually addressed in the upcoming 2.0 beta release (not pushed to github yet), but I will define look at back porting thing to 1.X.

Hi @tolo thanks for the prompt feedback. I have seen that is addressed in V2.0, which I am excited to get into using come release.

It would be amazing if you're able to port as I use InterfaCSS quite extensively and this little hiccup caused me some hassle.

Fixed in 1b6b18a, included in version 1.5.5.

Glad to hear you're using InterfaCSS extensively btw (and sorry about the hassle) :)

Thanks @tolo, very much appreciated, and even more so that you were able to do it so quickly. Life saver.

No worries, glad I was able to help 😄