Android Question Load typeface from device storage, not from assets?

noeleon

Active Member
Licensed User
Hi.

I want my users to be able to change some fonts in the app by loading their own dowloaded fonts. Is this possible?

Or how about loading from Android's fonts?
 
Last edited:

drgottjr

Expert
Licensed User
Longtime User
sure. having the user install fonts downloaded on the fly is the easy part.
the tricky part would be the download. what did you have in mind?
obviously you can't trust them to create url's for font downloads on their own.
i assume you would present the user with a webview, and they would
navegate to some site where fonts were available. they would then
download the font and store internally. they could then assign it to some view.
i don't think webview will let you download a font (you'll have to try it). or maybe
they could use chrome to download it. but then it would probably go into the
files folder on the device, and you'd have to use contentchooser for the user
to access it. with luck, they will have downloaded a compatible font.
letting users go off on their own is usually a bad idea; they mess stuff up and
blame you.

anyway, i just tried to download a font in chrome. technically it works. the font
goes into the downloads folder, and you can point contentchooser at it and copy
it to file.dirinternal. however, the first font i tried to download was in .zip format,
which means you're going to have to recognize that and act accordingly before
the user tries to install a zip file instead of a font file...

i then tried with webview, but webview doesn't seem to have a search bar, so
i didn't see any way for the user to navegate looking for fonts to download
(assuming webview will even allow that).

you'll need some other way for users to find and download fonts and then make
sure they are actual font files.
 
Last edited:
Upvote 0
Top