✏️ Font Variation 0.2.0 – Change font weight programmatically

:pencil2: Font Variation

Starting with Android O, variable fonts were supported for Android. To this day, they continue to be. With no way to change font weight besides download separate files, it gets overwhelming. So overwhelming that your application can’t hold your font files anymore, you have too many!

What’s needed

* Scroll down a bit to see an exmple!

  • A variable font, you can get one from fonts.google.com
    • Find your favorite font and use the Download family button in the top-right corner.
    • Unzip the downloaded file.
    • Find <𝚢𝚘𝚞𝚛-𝚏𝚘𝚗𝚝>-𝚅𝚊𝚛𝚒𝚊𝚋𝚕𝚎𝙵𝚘𝚗𝚝, it should appear in the root directory. Rename it if you’d like.
    • Upload it to your Kodular project!
    • Set is as your font for the “Font” property.
  • A label component
    • :warning: Other components aren’t yet supported.
  • The font weight you’d like your font to be displayed in
    • :1234: This value is normally between 100 and 900.
  • The font width you’d like your font to be displayed in
    • I’m not even sure how this works, but try for yourself. Setting this to -𝟷 will set it to default!

What font types are supported

  • An OTF file wasn’t tested
    • Most fonts from fonts.google.com only offer TTF variants.
    • OTF files are expected to work.
  • A TTF file was tested and worked fine
  • Others were not considered or don’t work with Android

Will this work with older Android versions

No, however, no minimum Android version is needed to use Font Variation. This was taken into consideration considering only about 7% of the Android population is running Android O. There is a check in place to make sure it only works on Android O and onwards, nothing will happen unless you’re running Android O and onward.

image

com.github.flailingoctopus.fontvariation.aix

21 Likes

Amazing work! :+1:

4 Likes

This is going to be amazing for font lover like me. Good work! :+1:

2 Likes

Nice Work @Squishy… , Oh Sorry @FlailingOctopus :sweat_smile: :+1:

1 Like

Awesome Work, Can’t Believe On My Eyes :eyes:

1 Like

@FlailingOctopus Nice job but there is some query that can it work with Dynamic label’s also

1 Like

Another one… :+1:
A very amazing and unique extension :wink:
Great job @FlailingOctopus aka squishy one :crazy_face:

2 Likes

It should work with labels created dynamically. In fact, extensions don’t have to add support for dynamic components.

2 Likes

great extension, that will help us a lot.

2 Likes

It will work with dynamic labels that is created by Dynamic Components extension as label(generated by extension) is a instance of a simple label. So it is same as a simple label component. However it would not work with in built dynamic label as the extension accepts Label datatype as a parameter(can’t say about this one), however in built dynamic label doesn’t return Label instance. Therefore if you use in built dynamic label then you’ll probably face an argument error by the extension.

1 Like

Thanks for confirmation

Thanks @Sumit1334 I got the full confirmation now

:pencil2: Font Variation 0.2.0

Before I begin, I want to thank you all for the amazing support given for this extension! It felt great doing something new and knowing that I’m helping people do what they like most.

ADDED

  1. A new property named “Font” was added. Testing showed that this completely resolved OOMEs and greatly improved performance, however, it may vary by device.
  2. A new function named “SetFontSettings.” Read more below.

CHANGED

  1. Memory management has been revised to include checking if the applications allocated memory heap is low. As with the OOMEs, when allocated memory is running low, nothing will happen.

DEPRECATED

  1. “SetFontVariationSettings” has been deprecated and will no longer work as a result of the newly added property and revised memory management. Use “SetFontSettings” instead.

:file_cabinet: Files

I apologize to everyone who this may have been an inconvenience to.

  1. com.github.flailingoctopus.fontvariation.aix
2 Likes

Nice let’s try something new now :grin::grin::grin::grin: thanks @FlailingOctopus

2021 Appathon

Hi all!

Following is a line from the 2021 Appathon FAQ.

You may use any extensions from MIT, or any free extension so long as you include a note from the extension author that it can be redistributed by MIT as part of the competition.

I’m not sure if this applies to free extensions, as I’m a bit confused by the sentence, however since my PMs are closed… Font Variation is allowed to be redistributed by MIT as part of the competition.

Good luck and have fun!

2 Likes