How to add custom font in app inventor option?

Thanks for helping me

which folder is the assets folder. If you are talking about apps asset folder then please I don't want to upload everytime please give me another way or if not then which?

1 Like

appinventor-sources/appinventor/appengine/war/static/ fonts /

1 Like

Having this error when I tried this:

[javac] C:\Users\Administrator\appinventor-sources\appinventor\components\src\com\google\appinventor\components\runtime\util\TextViewUtil.java:149: error: non-static method getAssets() cannot be referenced from a static context

BUILD FAILED
C:\Users\Administrator\appinventor-sources\appinventor\build.xml:16: The following error occurred while executing this line:
C:\Users\Administrator\appinventor-sources\appinventor\build-common.xml:341: The following error occurred while executing this line:
C:\Users\Administrator\appinventor-sources\appinventor\components\build.xml:215: The following error occurred while executing this line:
C:\Users\Administrator\appinventor-sources\appinventor\build-common.xml:125: Compile failed; see the compiler error output for details.

1 Like

is that full error?

1 Like

Yes this is the only error

This is the error.

Yes how to solve this error van you help me

Since we can't see your code, the most likely thing I can think of is that you're doing something like Context.getAssets(), which is wrong because getAssets() is an instance method but Context is a class. You need to call it on an instance of Context instead, typically by calling getContext() on some other Android object. If you've got an instance of Form lying around, it is a Context so you could also use that.

Code:

code:

Code:

Code:

After changing context.getassets to form.getasset im getting
this error:

@ewpatton please help

1 Like

Use container.$form().getAssets();

Not working

Because this is a util class, you won't have necessarily have access to the form. However, I think the View class in Android has a getContext method, which you should be able to use to get the necessary context for asset lookups.

3 Likes

Well, I have an idea for you @Tauqir_Tech_BD That will work for sure (I am also testing it)

Make a file selection box under label (Properties) add a custom font interface label before it to tell users what it does. Now, add the code that will set that font face to the one of .ttf file chosen by user. U can see the code of You font extension by Ken for reference to how to do so

Regards

1 Like

use

container.$context.getAssets();
2 Likes

Hello everyone,
Maybe this will help to simplify the problem, with a very simple example, working with android 12

You can download the apk from this link:

https://aplicaciones.xp3.biz/david/MyIcons.zip

To know the codes of each character:

  1. Install Regular Font Awesome 6 Free here:

https://use.fontawesome.com/releases/v6.3.0/fontawesome-free-6.3.0-web.zip

  1. install the font

  2. find or run in Windows: Charmap.exe

Select the font and you will find the icons of this font

  1. Before clicking on a character/icon, you will see the tooltip of the code that corresponds to it, we need the last 4 digits (exclude "U+") and those are the codes that the apk example puts.

The rest is to select that inputbox, and the slider to make it expand

To make it clickable, I used the ClickZ extension. see at:

Enjoy!

David

All you have to do is to get a ttf file(you can get in on fonts.google.com) and then upload it and use it. There are many fonts to choose :slightly_smiling_face:. Like this one, Pixelify Sans - Google Fonts
just go there and download a font.