elect
elect

Reputation: 7190

Font metric in OpenGL

is there any font metric like in Java (FontMetrics) ?

Ex:

FontMetrics fm = g2.getFontMetrics();
Rectangle2D rect = fm.getStringBounds(node.getText(), g2);

Upvotes: 0

Views: 259

Answers (2)

mlepage
mlepage

Reputation: 2472

No, text metrics and rasterization is its own complicated problem. A good free library for doing so is FreeType2. With it, you can load a font, get metrics on it, and rasterize it into a bitmap in memory.

Then, using OpenGL, you can store that bitmap in a texture, and use it (with metrics) to render text.

Upvotes: 0

Victor
Victor

Reputation: 98

That would not depend on OpenGL but on the font providing library, since OpenGL does not have native text rendering.

Upvotes: 5

Related Questions