question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

V4 - TextStyle `font` VS `fontFamily`

See original GitHub issue

Hello guys, well done with V4 release! Looks like migration from V3 is going to be pretty straightforward and I’m looking forward to check performance 😃

There’s one thing tho I’m not really sure about. It might be a stupid question, but… Shall I use font or fontFamilyfor TextStyle?

According to DOCUMENTATION-TextStyle:

font

Set all properties of a font as a single string

Deprecated
- since version 4.0.0

And fontFamily is there.
On the other hand, also from DOCUMENTATION-Text:

A Text can be created directly from a string and a style object

var text = new PIXI.Text('This is a pixi text',{font : '24px Arial', fill : 0xff1010, align : 'center'});

So this guy is still using font and wait, there’s more: V4 Text example is also using font.
I’m really puzzled by how does it work with font… I was even checking Text.js sources and it seems like it never uses style.font but it’s combining it like this._font = style.fontStyle + ' ' + style.fontVariant + ' ' + style.fontWeight + ' ' + fontSizeString + ' ' + style.fontFamily; So what kind of sorcery is that? And which one should be used?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
bigtimebuddycommented, Aug 25, 2016

Cool, thanks for your help @SlawomirMazgaj

1reaction
bigtimebuddycommented, Aug 25, 2016

Sorted. Thanks @SlawomirMazgaj!

Read more comments on GitHub >

github_iconTop Results From Across the Web

V4 - TextStyle `font` VS `fontFamily` · Issue #2859 · pixijs/pixijs
Shall I use font or fontFamily for TextStyle? According to DOCUMENTATION-TextStyle: font. Set all properties of a font as a single string.
Read more >
What is the difference between font and font family?
And a “font family” represents a collection of related fonts, such as bold and italic variations of the same “typeface” or “font”.
Read more >
font-family - CSS: Cascading Style Sheets - MDN Web Docs
The font-family CSS property specifies a prioritized list of one or more font family names and/or generic family names for the selected ...
Read more >
Specifying Fonts in R - Department of Statistics
This document discusses how R allows fonts to be specified. ... to be used to map into a text file of different fonts,...
Read more >
CSS Fonts - W3Schools
The CSS font-family Property​​ In CSS, we use the font-family property to specify the font of a text. Note: If the font name...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found