Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Proper way to use EditBox with Font?

Author
Message
2D Analyst
AGK Developer
18
Years of Service
User Offline
Joined: 2nd May 2004
Location:
Posted: 6th May 2020 00:55
I've loaded font.ttf and it works fine using setTextFont(). I couldn't get it to work SetEditBoxFont() as the results looks the same as the default font. Is there a certain order I need to set the syntax for EditBox to work with Font?

Below is the codes I'm using.

fubarpk
Retired Moderator
17
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 6th May 2020 01:24
try SetEditBoxFont(textBox.edtID, fontDefault) just after you create it, if you still cant see it try a large number for SetEditBoxTextSize ( index, size )

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
2D Analyst
AGK Developer
18
Years of Service
User Offline
Joined: 2nd May 2004
Location:
Posted: 6th May 2020 01:46
I tried it and still didn't worked. I can tell it's not the reading the new font because the new font is fixed width.

When I type the same character several times the cursor position is supposed to be in the same spot.

For example, I typed 10 same characters in a row using lower case letter i vs upper case Z: iiiiiiiiii vs ZZZZZZZZZZ.
blink0k
Moderator
9
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 6th May 2020 01:48
Are you setting UseNewDefaultFonts( 1 )?
2D Analyst
AGK Developer
18
Years of Service
User Offline
Joined: 2nd May 2004
Location:
Posted: 6th May 2020 02:35
yes, that did the trick! I had to disabled UseNewDefaultFonts( 1 ).

Now, it's reading the fixed width font, but it looks like EditBox with multi lines does not honor the fixed width spacing. If I type iiiii on line 1 vs aaaaa on line 2 edit box, the length is not the same. I tried using 4 different fixed width font and it works fine on text, but not editbox.
fubarpk
Retired Moderator
17
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 6th May 2020 02:57
Quote: "If I type iiiii on line 1 vs aaaaa on line 2 edit box, the length is not the same. "

that's how ttf fonts work for example w is wider than I not so sure if there is a way to allow bit map fonts
in edit boxes

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
Scraggle
Moderator
19
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 6th May 2020 06:48 Edited at: 6th May 2020 06:59
Quote: "that's how ttf fonts work"

Not for fixed width fonts it isn't. There's a clue in the name

I've just had a play with it and can't replicate your issue:

Consolas is a fixed width font and it appears as I would expect.

Attachments

Login to view attachments
2D Analyst
AGK Developer
18
Years of Service
User Offline
Joined: 2nd May 2004
Location:
Posted: 7th May 2020 01:23
Wow. I can't get the setEditBoxFont() to display fixed width properly, but I was able to get the setEditBoxFontImage() to work with fixed width. There's probably something within my codes that disable the setEditBoxFont()

I've used below link.

https://www.zimnox.com/resources/agk/utilities/

Appreciate everyone feedback and time! Now, I can continue working on my non-gaming app...hope to release it this month.

Login to post a reply

Server time is: 2022-12-01 13:25:10
Your offset time is: 2022-12-01 13:25:10