Query about Custom Font Support Project

Hello all,

Can anyone tell me exactly what project is about ?

according to this site this project is adding support of custom font typeface into component which supports textual content ?

am right or i am missing something ?

Yes, that's the crux of it. Presumably we would want them to just be able to pick from a list of valid fonts loaded into the app assets, although from the blocks side it would probably make sense for any string that resolves to a valid font file to work.

1 Like

app assets means user upload their font into assets and use same as other assets file?

@ewpatton

I have created a small proposal about this project can I DM you link of google docs ?

That's correct, but we'd probably want to limit the selection to assets which names match supported font formats, such as .ttf.

yes that's the good idea

@ewpatton Can you give me suggestion on this implementation approach...


Brief Explanation


An approach to enhance the functionality of MIT App Inventor by adding support of Custom Font typeface.


Abstract


Currently MIT App Inventor does not support custom fonts, the user can only choose between Sans-Serif, Serif, Monospace or default fonts, so the main abstract of the project is to add custom font support to visible components of MIT App Inventor like buttons, checkboxes, etc. .


How can this help the app created with MIT App Inventor?


Custom fonts allow you to use beautiful combinations of different fonts on your app to improve typography and user experience. Aside from looking good, custom fonts can also help you improve readability, create a brand image, and increase the time users spend on your app.


Deliverables


Designer Property & Simple Property

This project adds designer and simple property into all visible components which supports textual contents like button, checkbox etc..


...
private String fontTypeface;

 @DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_FONT_TYPEFACE, defaultValue = "")
  @SimpleProperty(userVisible=true)
  public void CustomFont(String fontFileName){
      fontTypeface = fontFileName;
      TextViewUtil.setCustomFontTypeface(form, (TextView)getView(), fontFileName, fontBold, fontItalic);
  }


  @SimpleProperty(description = "developer docs")
  public String CustomFont(String fontFileName){
      return fontTypeface;
  }

...

Supporting Method

This project add supporting methods for setting custom font typeface into TextViewUtil.java which is under com.google.appinventor.component.runtime.util package.


...
public static void setCustomFontTypeface(Form form, TextView textView, String fontFile, boolean isBold, boolean isItalic)    {
    // main implementation logic..😊
    // create FontTypeface object
    // calculate font style bold , italic or bold-italic both
    textView.setTypeface(Typeface.create(fontTypeface, style));
}
...

New Property Editor for Custom Font

New Custom font property editor is similar to PropertyTypeConstants.PROPERTY_TYPE_ASSET but items in dropdown will show only files which has .ttf extension.
I am not giving more explanation about this because post becomes lengthy.


Results


After implementation users can use custom fonts for their apps and its increased functionality and it allows more flexible user-interface designs.


Preet Vadaliya

2 Likes

I have submitted draft of proposal would any one of the mentor willing to review it?

Thanks & Regards

1 Like

Yes, we'll be reviewing draft proposals today.

Thanks you :slight_smile::slight_smile: