1
votes

Note for the readers: this question is not about standard CSS, but it's related exclusively to the CSS support of Codename One.

I'm not satisfied of the Material Font Icons included in Codename One. I want to replace almost all these lines:

FontImage.createMaterial(FontImage.MATERIAL_XXX, "ColorWhite", 4)

with something different taken from Fontello. In the past I read how to do that using the CSS support included in Codename One, but at the moment I'm not finding what I read. I only found this: https://www.codenameone.com/blog/using-icon-fonts-such-as-fontello.html, but it doesn't explain how to use the CSS.

So my question is the correct coding to use Fontello icons inside a Codename One app using CSS (is there any tutorial?).

1

1 Answers

1
votes

You can just declare the font as explained here https://github.com/shannah/cn1-css/wiki/Fonts

Roughly something like this:

@font-face {
    font-family: "Fontello";
    src: url(res/Fontello.ttf);
}

Then you can apply the font to any UIID you wish to use such as:

MyIcon {
    font-family: "Fontello";
}