darkmoon_uk
09/05/2022, 6:31 AMidentity
field...
Take the iOS function:
androidx.compose.ui.text.platform.Font(
identity: String,
data: ByteArray,
weight: FontWeight = FontWeight.Normal,
style: FontStyle = FontStyle.Normal
): Font
The identity
field is documented as:
identity - Unique identity for a font. Used internally to distinguish fonts.
...which suggests it can be any arbitrary, unique string right?
Seemingly not. See in 🧵 👉 for more...darkmoon_uk
09/05/2022, 6:35 AMidentity
- easy, right? Let's call the font InterStellar, so I had five variants to load:
◦ InterStellar-Regular
◦ InterStellar-Bold
◦ InterStellar-Light
◦ InterStellar-SemiBold
◦ InterStellar-Medium
• Using these above strings as identifiers causes a crash 💥; not at the point of loading the Font, but rather at the point of trying to render the font:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSMutableDictionary __addObject:forKey:]: object cannot be nil'
darkmoon_uk
09/05/2022, 6:37 AMFontFamily
down to one font with the identifier test
and... it rendered!darkmoon_uk
09/05/2022, 6:37 AMisa
and isb
as names, that crashes 💥darkmoon_uk
09/05/2022, 6:37 AMtest
and tsst
as names, it works ✅darkmoon_uk
09/05/2022, 6:38 AMdarkmoon_uk
09/05/2022, 6:38 AMinterstellarbold
, interstellarlight
etc... nope, crash 💥darkmoon_uk
09/05/2022, 6:38 AMdarkmoon_uk
09/05/2022, 6:39 AMfont1
, font2
, font3
etc. as internal identifiers.darkmoon_uk
09/05/2022, 6:39 AMdarkmoon_uk
09/05/2022, 6:40 AMDima Avdeev
09/05/2022, 7:39 AMdarkmoon_uk
09/05/2022, 7:55 AMcafonsomota
10/03/2022, 11:01 AMdata
@darkmoon_uk? 👼