Hello all of you :), i just wanted to ask you if it was posible to resize a Font using for example using GETFONTSIZE command?
Thanks in advance :)
I would like to create a big Font file and resize the characters at any size, depending on screen resolution :)
maybe something like this?
GETSCREENSIZE sx, sy
GETFONTSIZE tx, ty
tx = sx/99
ty = tx * 1.2
what about using X_PRINT?
Hi Jonaspm.
Resizing fonts is not native to GLbasic, neither is setting font colors, because the fonts are based on static images.
The easiest work-around which most people go with is to create a hand full of custom fonts using the Create Font utility built into GLbasic, and call them as needed.
A couple of programers have written custom font routines which are sizable, after a fashion, and they are available on this website. I'll poke around and see what I can find.
(Does anyone have a handy link?)
GLbasic has its strengths and its weaknesses. The strengths make some hard things ridiculously easy. For the other sort, we either devise work-arounds or learn to live with them. All in all, the strengths far outshine the weaknesses.
-CW
Hi Jonaspm,
A quick search turned up these two programs which may meet your need.
Check out this link: http://www.glbasic.com/forum/index.php?topic=2223.0 (http://www.glbasic.com/forum/index.php?topic=2223.0)
Or this link: http://www.glbasic.com/forum/index.php?topic=8207.0 (http://www.glbasic.com/forum/index.php?topic=8207.0)
There may be others.
-CW
except grapsprite can been muddy on some Android devices. Anyways there is no colors as well size on the glbasic font system. Howover its pretty easy to do you own, but its depend how you will use the font.
In my own im wrote a DrawImage function, which did the Polyvectors drawing from a regular bitmap, which can been colored too. Howover colored vectors can slowdown on some iOS devices.
Yes the first link did my self used, until im created my own.
thank you for your replies, can't X_PRINT work also? it has a #scale property...
The game where i would like to resize the text and sprites (i see it's posible to resize sprites) it's in 2D mode, but i think 3D mode allos scaling of sprites and text, anyway i will keep looking and thank you for the links! they will be very very handy
Use PV's or sprites for your font and scale away :D
Just come across this thread and realised I had a method of enlarging the current font that is quick and very simple.
/// Quick and simple enlarged font method.
/// Coded by Mark Cooper AKA BRICK REDUX
/// Could be handy for text adventures etc?
/// Define the bits needed for the moving title and scaling quit request.
y1=50 ; y1dir=1 ; factorx=1 ; factory=1 ; fdirx=1 ; fdiry=1
WHILE TRUE
text$="Enlarged Font demo!"
largefont(text$,120,y1,3,4,0,RGB(255,0,0))
text$="By displaying the text on a virtual screen"
largefont(text$,70,120,1.5,3,0,RGB(0,0,150))
text$="( CREATESCREEN ) you then ZOOM that Sprite"
largefont(text$,70,140,1.5,3,0,RGB(0,150,0))
text$="after a USESCREEN -1 call."
largefont(text$,100,170,1.5,3,0,RGB(150,0,0))
text$="Press <ESCAPE> to exit."
largefont(text$,110,300,factorx,factory,1,RGB(RND(255),RND(255),RND(255)))
text$="Brick Redux, 2013"
largefont(text$,120,400,2,3,1,0)
GOSUB FX
SHOWSCREEN
WEND
// A$=text / xpos/ ypos / zoomfactor X / zoomfactor Y / Smoothshading on/off / background RGB
FUNCTION largefont:a$,x,y,scalex,scaley,shading,background
SMOOTHSHADING shading
LOCAL size=LEN(a$)
CREATESCREEN 4,2,size*8,9 // Sprite 2
USESCREEN 4 // Use an hidden screen
DRAWRECT 0,0,size*8,9,background // Fill the background with a colour.
PRINT a$,0,0 // Now print the text
USESCREEN -1 // Back to reality!
ZOOMSPRITE 2,x*2,y,scalex,scaley // Scale the text!
ENDFUNCTION
SUB FX: /// Only needed here for the moving and scaling text.
INC y1,y1dir
IF y1<40 OR y1>80
y1dir=-y1dir
ENDIF
INC timer
IF timer=4
timer=0
INC factorx,fdirx;INC factory,fdiry
IF factorx<0 OR factorx>5
fdirx=-fdirx
ENDIF
IF factory<0 OR factory>5
fdiry=-fdiry
ENDIF
ENDIF
ENDSUB
And with alittle tweaking, you could use my former selfs :) colour alteration routine: http://www.glbasic.com/forum/index.php?topic=8207.msg69270#msg69270 too. :)
Oh! Brick Redux, thanks a lot for helping me and all the GLBasic community :)
I will try your method as fast as i can, again, THANK YOU! :D
Hi
attached my work ( thanks to the community of GLBasic) about resize font.
If interesting i will send source and istruction.
Ciao
Qedo
http://web.tiscali.it/edoardobianchi/STUFF/font/Animation_Font.app.zip
Oooh. That's great Qedo.
I wrote something to use GLBasic style fonts with kerning and justification using polyvector commands for speed but its basic. Your routine is wayyyy better. For sure source would be appreciated by me. Instruction too, if you have the time.
Yeah looks very good, i want to see the soure too.
as soon as I finish the conversion from FUNCTION to TYPE (for better style programming) i will send you the source,
Ciao
Qedo
Quote from: Ocean on 2013-Oct-24
on another note: has anybody ever done vector fonts for GLB ?
Well, there is this routine to draw SVG and DXF objects with Polyvectors (http://www.glbasic.com/forum/index.php?topic=9026.0).
sorry for the delay (source program) but in GLBasic 11.559 the program don't work. see picture.
I dont know if is a bug. I'm working.
Ciao
Qedo
Send the source (without comment, sorry)
Solved moving the command USESCREEN 5 from outside NEXT loop to inside.
I don't Know if it is a bug, but GLBasic 11 seems reset to USESCREEN -1 at every cycle of the loop.
OK on Windows. On Android OK on BlueStack but don't work on my Sony :(.
Can you try?
Thank you
Qedo
http://web.tiscali.it/edoardobianchi/STUFF/font/Animation_Font_source.zip
CREATESCREEN 5, single_id_sprite, w,h
//USESCREEN 5 // work in GLBasic 10, NOT in GLBasic 11.559
FOR i=32 TO n_car
USESCREEN 5 // work in GLBasic 10 and in GLBasic 11.559
CLEARSCREEN RGB(0,0,0)
DRAWANIM self.id_sprite% , i, 0, 0 // stampa il carattere i dello sprite
ok% = SPRITE2MEM(pix[], single_id_sprite)
.....
.....
.....
NEXT
USESCREEN -1/code]
Thank you for your source! :good:
What setting for the font creator do you recommend? Char_width = Char_hight? Something else important? Better using the original UO Dingsfont or blastars improved UO Dingsfont (http://www.glbasic.com/forum/index.php?topic=6421.0) which is way better IMHO?
What is the reason for the function CHECK_COMP_SPRITE2MEM are there machines where this would fail? I think SPRITE2MEM should work always...
---------
I can confirm your bug, but I think its not the loop that is causing it, but the SPRITE2MEM. There was a bug with CREATESCREEN+MEM2SPRITE (see V11 change log), I think there is also one with USESCREEN+SPRITE2MEM. Nice find.
Use Char_width = Char_hight 128x128 pixel with Blastars improved UO Dingsfont.
See the picture for setting (A picture is worth a thousand words).
I have used CHECK_COMP_SPRITE2MEM because on some computers (old) with Intel integrated graphic card and probably others, SPRITE2MEM don't work (zero value array).
I think you are right, there is a USESCREEN+SPRITE2MEM bug.
Ciao
Qedo