Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Using Images for Text? (https://forums.graalonline.com/forums/showthread.php?t=134265889)

scriptless 03-05-2012 02:12 AM

Using Images for Text?
 
So I was wanting to use those cool numbers from state.png. I did the math.

Starting at:
PHP Code:

x=1
y
=81 

Using a width of 14 and a height of 16 I was able to draw the numbers using showimg and changeimgpart.

PHP Code:

changeimgpart(423,1+(14*3),81,14,16); 

Resulted : 3
My question is there a way to use images as font's for this?

DustyPorViva 03-05-2012 02:14 AM

http://forums.graalonline.com/forums...hp?t=134258865

It depends on how complex you want this to be. For my thread above(using state.png) it's fairly simple because you assume every character is the same width. However if you start rendering letters using a nonfixed-width font image then things get more complex as you need to start taking in to consideration kerning and spacing. This requires you to build an array of each character width, and to keep track of the last letter placement + width before placing the next character.

cbk1994 03-05-2012 02:28 AM

It would probably be easier to just make your image into a TTF file, upload it to the server, and use it as a font (e.g. "fontFace = \"myfont.ttf\"").

scriptless 03-05-2012 02:30 AM

Quote:

Originally Posted by DustyPorViva (Post 1686978)
http://forums.graalonline.com/forums...hp?t=134258865

It depends on how complex you want this to be. For my thread above(using state.png) it's fairly simple because you assume every character is the same width. However if you start rendering letters using a nonfixed-width font image then things get more complex as you need to start taking in to consideration kerning and spacing. This requires you to build an array of each character width, and to keep track of the last letter placement + width before placing the next character.

Yes, using state.png. I understand how the width's can give difficulties if not positioned right.. I was only asking is this good to show alot of images like this or would there be easier method, like TTF's..

Quote:

Originally Posted by cbk1994 (Post 1686981)
It would probably be easier to just make your image into a TTF file, upload it to the server, and use it as a font (e.g. "fontFace = \"myfont.ttf\"").

Was what I was thinking. I only ask this question because of having to show alot of images as numbers..

DustyPorViva 03-05-2012 02:37 AM

If the only thing you want to do is display numbers then I suggest an image. Especially if it's for graphical effect, where rendering fonts in large sizes can cause a lot of slowdown. Using an entire font just to display numbers is overkill I think.

scriptless 03-05-2012 02:40 AM

Quote:

Originally Posted by DustyPorViva (Post 1686983)
If the only thing you want to do is display numbers then I suggest an image. Especially if it's for graphical effect, where rendering fonts in large sizes can cause a lot of slowdown. Using an entire font just to display numbers is overkill I think.

Basically you know the bomb's, arrow's, rupee's on the current GUI? I am trying to redo the GUI and im needing to draw alot of numbers, couple dozen.

Get's confusing really fast working with that many images. As for fon't size, I think 14x16 pixels per letter is plenty and I will probably not need any larger or smaller font's.

DustyPorViva 03-05-2012 03:14 AM

Quote:

Originally Posted by scriptless (Post 1686984)
Basically you know the bomb's, arrow's, rupee's on the current GUI? I am trying to redo the GUI and im needing to draw alot of numbers, couple dozen.

Get's confusing really fast working with that many images. As for fon't size, I think 14x16 pixels per letter is plenty and I will probably not need any larger or smaller font's.

Well the thread I linked already handles everything you asked for :)

As for using a font, the problem is that I'm not aware of any font format that allows bitmap format with more than 2 colors(font color and transparency).

scriptless 03-05-2012 03:27 AM

Quote:

Originally Posted by DustyPorViva (Post 1686985)
Well the thread I linked already handles everything you asked for :)

As for using a font, the problem is that I'm not aware of any font format that allows bitmap format with more than 2 colors(font color and transparency).

2 colors? Not sure what you mean exactly. I can use 2 color's in font? If so that would work. And transparency? I am confused, wouldnt I just use black and have font color change the color itself? im only curious on how to get the shadow behind the number like state.png kinda does.


All times are GMT +2. The time now is 02:02 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.