Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 1,807
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.3.2.858, Z10 (STL100-3)-10.3.1.2576, Z30 (STA100-5)-10.3.1.2582, Passport (SQW100-1)-10.3.1.2576, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Fonts 5.0

I am doing some OpenGL programming but OpenGL does not include any drawing-text functions in it's standard so I am trying to create a dynamic OpenGL font system using some open source code. Because of this I need to know a couple values that are not present in RIM's font system.

 

First, how do you get the width of the glyph and the glyph only? I know I can get it's advance but I don't need that right now.

 

Second, how do you get the FontMetrics? The function getMetrics requires you to add a FontMetrics object, but this object does not include a constructor and cannot be created.

 

Am I missing something on how to do this?

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Developer
Posts: 1,807
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.3.2.858, Z10 (STL100-3)-10.3.1.2576, Z30 (STA100-5)-10.3.1.2582, Passport (SQW100-1)-10.3.1.2576, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: Fonts 5.0

So does anyone know how to get only the glyph width or how to set a FontMetrics object?

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Developer
Posts: 562
Registered: ‎09-30-2009
My Device: Not Specified

Re: Fonts 5.0

[ Edited ]

Perhaps in OpenGL proper text rendering is standard, but I don't think there is in ES. There is a lot out there about how text rendering is handled in GL ES on other platforms that may be similarly applicable.

Highlighted
Developer
Posts: 1,807
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.3.2.858, Z10 (STL100-3)-10.3.1.2576, Z30 (STA100-5)-10.3.1.2582, Passport (SQW100-1)-10.3.1.2576, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: Fonts 5.0

OpenGL ES doesn't have a standard for text rendering and I did some searches and came across what seems like a good text library but it requires the font width and I only have the font advance. It doesn't seem like a big deal but I haven't fully wrapped my head around how the whole library works so I don't want to take chances. I am using this library because I want some "constant" that I can use over and over without needing to re-hack together some font rendering code.

 

I am also encountering problems with changing the camera matrix (so I can actually see what the text looks like, if it is even working) and so I tried running it on a physical device but ran into issues (http://supportforums.blackberry.com/t5/Java-Development/API-5-0-RIMAPPSA2-signing-required-for-app-t...) so I can't test it there.

 

Finally the last problem I am having is there is no way to create a new FontMetrics object (no constructor) and the function to get it (getMetrics) requires the object as a parameter. So I don't know how to do this right now and am hoping for someone who knows about fonts (they don't need to know OpenGL) to hopefully have an answer. Thanks for posting though, sorry for the rant and rehash.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.