Juicy Fonts -- text appearing too far to the left

BlitzPlus Forums/BlitzPlus Programming/Juicy Fonts -- text appearing too far to the left

Tomas Khan(Posted 2009) [#1]
I just downloaded Juicy Fonts (mainly for the word wrap), put together a font, and put it in a game with these lines:

Graphics 640, 480
SetBuffer BackBuffer()
AutoMidHandle True
SeedRnd MilliSecs()

Include "LIB_juicy_fonts.bb"

frametimer = CreateTimer(27)

Global thefont = jf_load_font("Kartika32.png")

Color 0, 0, 0 ;Doesn't affect the JF font. It's in there for the normal text

;A few constants and globals that I wouldn't think would affect the fonts
;Then a few types, but I don't think any match the ones in the LIB
;After that, I create everything, draw a title screen, then --

While Not KeyDown(1)

WaitTimer(frametimer)

Cls

If playerhp > 0 And level <= 50

...

jf_text(thefont, 450, 0, "Level: ", 0, 0)


Why does the text appear half off the top of the screen and a little off the left side?

I haven't used Origin (which would have altered the whole screen anyway). I think the letters are individually centered, in case that's important. Also, I put all of the Juicy Fonts commands (including the Include line) after the Graphics call, as the website said that something or other had to be done after the graphics mode was set.

Thank you!


epiblitikos(Posted 2009) [#2]
I'd be willing to take a look, but need to see more code (for context). Other than that, try remaking the font? JF might have bugged on something.


Tomas Khan(Posted 2009) [#3]
How much and what kind would you need to see? (e.g., the Graphics call might be important, as would the start of the game loop, but not necessarily the types?)

If it doesn't work, that's okay; just being able to experiment with the fonts is half the fun, and as I said, I mainly got it for the word wrap. (It's really no fun to have to do it manually, you know.)

... In fact, I'll just put in a bit more code and pseudocode and see if that helps. Thank you!


epiblitikos(Posted 2009) [#4]
Basically I would just want to look at the graphics section. Hopefully I can help you.


Tomas Khan(Posted 2009) [#5]
Well, the JF function positioning problem remains an unsolved mystery... which is okay for me now, because I've made a function that lets me use totally custom fixed-width fonts -- at least as far as unchanging strings go -- at the cost of having to declare every string I use. In fact, I'm pretty sure I can even use other images as an "alphabet," which would be entertaining, if extremely hard to decipher.

Thank you for your help, I quit programming. I guess whatever the problem was wouldn't have been a quick fix, and after all, it's more rewarding to see my own personal font printed on the screen despite the fact that it isn't an actual font. Thank you!


zx9rflipper(Posted 2011) [#6]
Blimey!!!!
I know that this an old post but I had just the same problem a few days ago....
The culprit is AutoMidhandle True

Get rid of this, and manually set up each graphic handle as a midhandle, and you'll find the JF text commands now work on the x co-ords properly.

Craig