Android custom fonts in web scroller native control...

J. Landman Gay jacque at hyperactivesw.com
Fri May 31 12:22:38 EDT 2013


On 5/31/13 5:27 AM, Paul Maguire wrote:
> I am porting an iOS app to Android. I have many issues (of course).
> The first of these is the use of custom fonts in HTML used in a web
> scroller native control. I have successfully embedded the font in the
> app - it is .ttf - and it displays properly when used in the Livecode
> UI I have set up. Only in the web scroller does it fail.
>
> Of course it works fine in iOS (sigh). I have tried the following in
> the styles in the HTML:
>
> @font-face { font-family: "GROBOLD"; src: url('fonts/GROBOLD.ttf');
> }
>
> ... but fails too. It seems I have a pathname issue with Android. I'm
> using specialFolderPath("engine") eg.:
>
> put (specialFolderPath("engine") & slash & "Media/footer.png") into
> tImageURL put "<p><img src = "&QUOTE& tImageURL&QUOTE&" width =
> "&QUOTE&"50"&QUOTE&"></p>" into tS
>
> ... but this fails to display too, so the pathname is wrong. I don't
> understand! I notice from the Android .apk file structure that all my
> assets (including fonts) are contained in a folder called 'assets' -
> which doesn't exist in the iOS .app file, but adding this to the URL
> fails too.

The path isn't the problem. Folders on mobile are virtual; the 
specialFolderPaths are redirected by the engine to the resources stored 
in the assets folder. You shouldn't need to worry about that, and your 
path is okay.

How are you loading the font? As far as I know, custom fonts are loaded 
with an external and those aren't supported on Android yet. But maybe 
the engine is supposed to load mobile fonts automatically; I haven't 
needed to try that so I'm not sure.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the Use-livecode mailing list