how i can add a symbol to a face?(symbol of heart)

how i can add a symbol to a face?(symbol of heart) 

  • Two ways to go it.

    1) add a draw-able for the heart to your app.  Start with something like a png and size it as you need

    2) use a custom font with this (again using something like png files or pixel editing) and other icons you need and just use that font to display it.

  • i used BMFONT to create a font butt i don't know how to call it :

        dc.drawText(200, 22, customFont, "XXX", Graphics.TEXT_JUSTIFY_RIGHT);

    what i have to type instead of the XXX ?

  • When you create afount, you associate a the glyph with a character.

    You need to load the font, and let's say "H" is the  heart symbol

    dc.drawtext(x,y,iconFont,"H",Gfx.TEXT_JUSTIFY_RIGHT);

  • It's done in the fnt file.  There a character maps to an x/y in the png.

    Here's a simple one of mine:

    info face="connect-icons" size=18 bold=0 italic=0 charset="" unicode=1 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1 outline=0
    common lineHeight=18 base=15 scaleW=256 scaleH=256 pages=1 packed=0 alphaChnl=1 redChnl=0 greenChnl=0 blueChnl=0
    page id=0 file="i18_0.png"
    chars count=7
    char id=65   x=15    y=0     width=13    height=14    xoffset=0     yoffset=4     xadvance=17    page=0  chnl=15
    char id=66   x=87    y=0     width=15    height=8     xoffset=-1    yoffset=4     xadvance=17    page=0  chnl=15
    char id=72  x=40    y=0     width=15    height=13    xoffset=-1    yoffset=2     xadvance=17    page=0  chnl=15
    char id=68  x=56    y=0     width=15    height=10    xoffset=-1    yoffset=6     xadvance=17    page=0  chnl=15
    char id=78  x=0     y=0     width=14    height=14    xoffset=0     yoffset=4     xadvance=17    page=0  chnl=15
    char id=83  x=29    y=0     width=10    height=14    xoffset=2     yoffset=2     xadvance=17    page=0  chnl=15
    char id=67  x=72    y=0     width=14    height=10    xoffset=0     yoffset=6     xadvance=17    page=0  chnl=15
    

    In this case "H" (char id=72)

  • if all you want is the one symbol, a heart, i did one using simple graphics drawing function. dc.fillCircle x 2, fillPolygon for the lower part.

  • tnx it works after i changed the char id in the font file

  • how can i  associate  the font that i created in the layout xml ?
    <label id="Heart" x="300" y="155" font="Graphics.FONT_LARGE" justification="Graphics.TEXT_JUSTIFY_LEFT" color="Graphics.COLOR_RED" />

  • You need to specify the name of your custom font resource as the value for the font attribute you've highlighted.