Adjusting fonts

  • #1, by ikarusSaturday, 09. August 2014, 21:56 11 years ago
    Hi there!

    I have my very first trouble with VS. I've uploaded my chosen font in the engine and it works well but some letters have a little mismatch at baseline: they show itselves a few pixels up or down the default height. Is there a way to adjust the letters individually or to fix it anyway? What can be the cause? Apparently the font template .png is correct...

    Thanks in advance.

    ------------------------------------------

    (Spanish)

    Hola a todos:

    Tengo mi primer problema con VS. He cargado mi tipografía y funciona bien, pero algunas letras presentan un cierto desajuste en la línea de base: se muestran unos píxeles más arriba o más abajo de lo que deberían. ¿Hay algún modo de ajustar las letras individualmente o de arreglarlo como sea? ¿Cuál puede ser la causa de esto? Aparentemente, la plantilla de la fuente en .png está correcta...

    Gracias por adelantado.

    Newbie

    37 Posts


  • #2, by afrlmeSunday, 10. August 2014, 01:30 11 years ago
    I think the baseline _ thing depends on the font & size of the font. If the font is not all aligned correctly then it may not register correctly - I'm not 100% sure about how the font image maps work.

    But err you can now use ttf fonts in 4.0 & there's loads of nice free fonts available on websites like dafont.com.

    Imperator

    7285 Posts

  • #3, by ikarusSunday, 10. August 2014, 11:34 11 years ago
    OK. It seemed to me that the font was correctly aligned (in the template), but I suppose I should use a real TrueTypeFont and forget this little issue... Thanks.

    Newbie

    37 Posts

  • #4, by ikarusMonday, 11. August 2014, 10:53 11 years ago
    One more question: If I use a TTF font, the line spacing selector turns inactive. Why? Do you know how can I choose the number of pixels between lines then?

    Newbie

    37 Posts

  • #5, by afrlmeMonday, 11. August 2014, 12:11 11 years ago
    Hmm maybe it's just an oversight. I think that line spacing & space width should also be active for ttf fonts as well.

    I'll ask David about it later.

    You can access some of the settings via lua script but according to the data structure they are not scriptable. Check here.

    I suppose if it will let you script them that you could try adjusting them on game start...
    local font = getObject("Fonts[font_name]")
    
    font:setValue(VFontSpaceWidth, 5) -- 5 pixels between word spacing
    font:setValue(VVerticalLetterSpacing, 10) -- 10 pixels between lines
    


    * edit: the code isn't affecting the font.

    Imperator

    7285 Posts