• Dear Cerberus X User!

    As we prepare to transition the forum ownership from Mike to Phil (TripleHead GmbH), we need your explicit consent to transfer your user data in accordance with our amended Terms and Rules in order to be compliant with data protection laws.

    Important: If you accept the amended Terms and Rules, you agree to the transfer of your user data to the future forum owner!

    Please read the new Terms and Rules below, check the box to agree, and click "Accept" to continue enjoying your Cerberus X Forum experience. The deadline for consent is April 5, 2024.

    Do not accept the amended Terms and Rules if you do not wish your personal data to be transferred to the future forum owner!

    Accepting ensures:

    - Continued access to your account with a short break for the actual transfer.

    - Retention of your data under the same terms.

    Without consent:

    - You don't have further access to your forum user account.

    - Your account and personal data will be deleted after April 5, 2024.

    - Public posts remain, but usernames indicating real identity will be anonymized. If you disagree with a fictitious name you have the option to contact us so we can find a name that is acceptable to you.

    We hope to keep you in our community and see you on the forum soon!

    All the best

    Your Cerberus X Team

Font Size

You either load a bitmap font the size you like or you use SetScale to scale the output text (but this will make the font blurry).

Both Mojo and Mojo2 don't use "native" font render machines, meaning they don't load system fonts like Arial.ttf which can be drawn in any size or style. What they do is bitmap font drawing: They load an image containing glyphs (ASCII 32-127 I think) and draw them when drawing text. The default fonts are
modules\mojo\data\mojo_font.png
modules\mojo2\data\mojo2_font.png
 
If I remember there is no function to change the size of a font.
You have three approaches
  1. Have another scaled version of the Font loaded and use SetFont.
  2. Use PushMatrix, Scale, DrawText, PopMatrix command in the order given.
  3. Create an array of source image positions, widths and height and use the DrawImageRect command.
 
If you want better control of a font, then search the forum for the FontMachine. It may have been updated to work with the latest version of Cerberus.
 
Though this is an old thread, here's my two cents: If like, you might want to try my free Font 2 PNG program, link. At the page there are example programs using the output of Font 2 PNG. The programs are written in Monkey X and work as such with Cerberus X. Also two links for implementing a font class for Font 2 PNG's output. Font Classes include changing font size.
 
Wait, does this mean you have found a way to load a ttf file in Monkey / Cerberus? :eek: I'll check this out!
 
Wait, does this mean you have found a way to load a ttf file in Monkey / Cerberus? :eek: I'll check this out!
No I don't. I was thinking of a scaling factor while drawing the font. We're still talking bitmap fonts.
 
You should be able to use the Freetype library to render ttf's in a GL/EGL context. There should be plenty of tutorials, etc on the subject.

Here's a quickie.
 
Last edited:
I should point out that you will of course be taking a performance penalty hit using ttf with GL.
 
And why? Isn't rendering glyphs stored in a texture loaded from a png file not very similar to rendering glyphs stored in a texture filled via a routine that renders vector based fonts? I can see why this would affect loading speeds. But the actual rendering?
 
Isn't rendering glyphs stored in a texture loaded from a png file not very similar to rendering glyphs stored in a texture filled via a routine that renders vector based fonts?
Yes they do work in a similar fashion. The main issues would be getting the best use of texture space, dealing with unicode and how much text you can get into a single Vertex Buffer Object to improve performance.

It my be worth looking into Font-Stash and FTGL.
 
@Raph Ah! This looks useuful. Is the google code repo broken though? I'm getting a "There was an error getting resource 'downloads':"

So the only copy is that big copy+pasted block?
 
Search in github for tfont. It will bring up a repro with chris's code. I was playing with at it is usable. The advantage is that runs on all mojo targets. Now i will think of a way to integrate it and port this to mojo2 ss well.
 
Back
Top Bottom