Thread Tools Display Modes
10-01-11, 04:09 PM   #1
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
Help with font

Hi,

I'm new to addons coding, making my first steps here.
I'm trying to make a simple frame with a title, and I don't understand how font works.
I downloaded several .ttf fonts, but they didn't work (nothing was printed). And then I just copied a working font to a different folder, and it didn't work as well!

This one works:
Code:
<Font name="AnimorFont" font="Interface\AddOns\SharedMedia\fonts\Adventure.ttf" virtual="true">
	<Shadow>
		<Offset>
			<AbsDimension x="1" y="-1"/>
		</Offset>
		<Color r="0" g="0" b="0"/>
	</Shadow>
	<FontHeight>
		<AbsValue val="10"/>
	</FontHeight>
	<Color r="1.0" g="0.82" b="0"/>
</Font>
However, when I copied the .ttf file to a different folder and changed the font to:
Code:
font="Interface\AddOns\MyFonts\Adventure.ttf"
It just didn't work. Nothing was printed.
I run with no addons loaded, except for the simple addon I'm playing with, which has no libs or anything special.

What am I missing here?
Any help is appreciated
  Reply With Quote
10-01-11, 04:37 PM   #2
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
I have found the problem!

For some reason, I should completely exit WoW when I change the font path in the XML.
Logout and Login are not enough, not sure why.
  Reply With Quote
10-01-11, 06:15 PM   #3
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
WoW is sandboxed. When changing the path of any file (ie, moving or renaming) or adding new files, you need to completely restart the game for it to re-index its directory.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
10-03-11, 03:43 AM   #4
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
Thank you for the answer

I have another question regarding fonts, so I'll use this thread to ask it:
I was trying to display special characters (Hebrew letters), which are not supported in WoW fonts. When I initially tried it, I got "?" instead of the string.
Then I used a font that support those characters, and I managed to get it displayed in-game, even though it was reversed since Hebrew is right-to-left language.

However, when I tried the same font on an EditBox, I couldn't type in-game those characters. I clicked alt-shift to change language, but I got the strange Latin characters that I always get in WoW. The same EditBox could display those chars when I used SetText() on it. I just couldn't type them in-game.

So the questions are:
1. How can I type in-game special characters, like in windows? I know the font already support them, since I can display them if I type them on XML/LUA.
2. Is there a way to define right-to-left text in XML?

Thanks in advance for any help!
  Reply With Quote
10-03-11, 11:15 AM   #5
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,323
One question I would ask, even if you got this to work on your end, how would you get it to display in chat for example for someone that doesn't have the font modification? The chat system works in a UTF-8 format, but the fonts used are on the local system. What you use isn't automatically shared by everyone else.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
10-03-11, 11:34 AM   #6
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
Originally Posted by SDPhantom View Post
One question I would ask, even if you got this to work on your end, how would you get it to display in chat for example for someone that doesn't have the font modification? The chat system works in a UTF-8 format, but the fonts used are on the local system. What you use isn't automatically shared by everyone else.
Hi,

Well, I intend to use it only among friends who use the addon (which will have the font .ttf) and have their Windows set for the proper language/keyboard. I understand that the language I use is local to my Windows settings.

Do you know why I can't type those letters in-game? If you do, I would be happy for an explanation and a way to resolve it.

Thanks
  Reply With Quote
10-03-11, 11:47 AM   #7
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
How are you replacing the font currently?
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
10-03-11, 11:55 AM   #8
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
Post

Originally Posted by Seerah View Post
How are you replacing the font currently?
For now I just experimenting, so I have an editbox which use my font. This is the code:
Code:
<EditBox name="$parent_Input" parentKey="input" autoFocus="false">
	<Size x="400" y="20"/>
	<Anchors>
		<Anchor point="BOTTOMLEFT">
			<Offset x="32" y="100"/>
		</Anchor>
	</Anchors>
	<Scripts>
		<OnEscapePressed>
			self:ClearFocus()
		</OnEscapePressed>
	</Scripts>
	<FontString inherits="AnimorFont">
		<Color r="1" g="1" b="1"/>
	</FontString>
</EditBox>
I can display Hebrew chars in this editbox using SetText(), but I can't type them in-game.

After I get this to work I intend to do the same for the chat editbox.
  Reply With Quote
10-03-11, 12:08 PM   #9
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Your editbox has been set to use your font. You need to call :SetFont() on the editbox to make it use that font, too. http://wowprogramming.com/docs/widge...stance/SetFont

Or... Use this method of replacing the default fonts: http://www.vranx.com/font.htm
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
10-03-11, 01:18 PM   #10
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
Originally Posted by Seerah View Post
Your editbox has been set to use your font. You need to call :SetFont() on the editbox to make it use that font, too. [url]http://wowprogramming.com/docs/widgets/FontInstance/SetFont[/url
I tried it, but it didn't work...
The EditBox can display my text, unlike the default EditBox. For example, I can copy-paste the Hebrew text from windows.
However, when I type it in-game, I get those Latin-like letters.
Here is a screenshot (attached as well):
http://www.up2me.co.il/images/47004423.jpg

I just don't understand if that's an issue with the font I'm using, or perhaps I'm missing something else here.
Attached Thumbnails
Click image for larger version

Name:	WoWScrnShot_100311_205930.jpg
Views:	628
Size:	20.0 KB
ID:	6532  
  Reply With Quote
10-03-11, 03:14 PM   #11
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Right, I meant that you need to call :SetFont() on the default edit boxes you wish to change.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
10-03-11, 06:29 PM   #12
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,323
I was almost certain WoW had built-in IME support, but I'm not sure how to get to it.

Edit: This seems to be controlled by EditBox:ToggleInputLanguage(). For chat, you can enable the toggle button by setting the global CHAT_SHOW_IME to true.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 10-03-11 at 06:42 PM.
  Reply With Quote
10-04-11, 06:04 AM   #13
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
Thank you both for your answers!

Originally Posted by Seerah View Post
Right, I meant that you need to call :SetFont() on the default edit boxes you wish to change.
Right now I'm working on a specific EditBox, and I can control its font using either SetFont() or FontString in XML. By the way, according to what I've read, they both do the same.

Originally Posted by SDPhantom View Post
I was almost certain WoW had built-in IME support, but I'm not sure how to get to it.

Edit: This seems to be controlled by EditBox:ToggleInputLanguage(). For chat, you can enable the toggle button by setting the global CHAT_SHOW_IME to true.
I tried using ToggleInputLanguage on my EditBox, but it remained on Roman...
I don't know how to make it really toggle the input language.

Here is more information I gathered: WoW works with utf8, which means more than one byte for special chars.

When I alt-shift to change language and click "a", I get the char "ù". The ascii in WoW (according to string.byte method) is: /195/185
What I really wanted to get is the Hebrew char "ש" (not sure you can see it properly), which has WoW ascii of /215/169.

I guess I can make a conversion function, but it would be best if I find a way to make the keystrokes get ascii of /215/xxx instead of /195/yyy

Any ideas or help?
  Reply With Quote
10-04-11, 11:57 AM   #14
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,323
I think you have to have your IME set up in windows too, not sure. A little more digging around reveals that WoW only supports the Chinese, Korean, Japanese, and Roman charsets. Roman is the default and from the documentation on WoWProgramming.com, the list is restricted by locale and OS settings. All I can do from here is look at the code for the default UI, I have no means to test this functionality right now.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
10-04-11, 02:34 PM   #15
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
Originally Posted by SDPhantom View Post
I think you have to have your IME set up in windows too, not sure. A little more digging around reveals that WoW only supports the Chinese, Korean, Japanese, and Roman charsets. Roman is the default and from the documentation on WoWProgramming.com, the list is restricted by locale and OS settings. All I can do from here is look at the code for the default UI, I have no means to test this functionality right now.
I wrote a function that convert those Roman special chars to Hebrew chars, by manipulating the ascii code.

Now I'm dealing with the issue of right-to-left and left-to-right text. I couldn't find a support for right-to-left in xml, so I'm moving chars within the string, which is quite complicated....

Thanks for the help
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Help with font


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off