It's easy: Fonts do not need to match resolution, they need to match pixel density.
Pixel density is measured as pixels per inch(PPI), or pixels per centimeter. There's also a measure unit called density independent pixels(DP). It is defined that 1dp is the size one pixel has on a 160 PPI screen.
Now coming back to fonts, try to make this test: put your ...
You seem to want to keep the same textsize/screensize ratio. Basically what you do is develop at one resolution and let that be scale 1.0. Then you divide the new screen width by the old width and that is your scale factor.
Developing on 2560x1440 with font size 16 and running on 1920x1080.
Font size will be: 1920 * 16 / 2560 = 12
I do the ...
If you use a font rendering engine like FreeType, then the most common mistake is to re-render strings every frame. This is pointless, because when you render a string, it will usually be on the screen unchanged for at least a few seconds.
When you want to display a text, render that text to a texture once and then draw that texture instead of re-rendering ...
So what I had been thinking has been confirmed: The dialog is built with a single NinePatch so you need to adjust the size of the title bar manually within the .atlas file and .png file.
This will basically be a little How to use a JSON file with LibGdx tutorial.
LibGdx has a very useful Class called Skin. It allows you to have a .json file along with ...
From this topic: http://badlogicgames.com/forum/viewtopic.php?t=8573&p=38930
You should try not to do the following: (Quote from one of the GDX creators)
.. draw stuff from both ...
And from me - Don't use ShapeRenderer for drawing - it's for debugging purposes.
Instead of this create a ...
Truetype fonts are vector based. So you would have to trace the glyphs with a vector editor and then use a program like FontForge (which also is a vector editor) to build a font from that.
That said, You do not need to use TTF fonts in MonoGame since it just renders the font to a texture at compile time.
There are many bitmap font programs/examples ...
Is attribution sufficient for a CC BY-SA 3.0-licenced font in a video game? Is it enough just to credit the creator?
Do I have to sell my game under the same license?
The web clearly states "the material".
Here, the material is the font. If you only use the font in your game, you only need to give the appropriate credit:
You must give ...
The reason you are getting this behaviour is because of coordinate system. The base coordinate for your sprites is "left,bottom" (classic Cartesian) however all offsets in fnt files are assuming inverted Y axis (drawing from "left,top" of the sprite).
So instead of (you may notice this gives correct align, but on the top, i.e. g goes up instead of down):
The fileformat.info page you linked to contains a link “Fonts that support this block”. The ones listed there with 100% support are—
Everson Mono (cost: €25; license: Everson Mono Shareware License), and
GNU Unifont (cost: free; license: GNU GPL, with virality-exemption for embedding)
My approach is to do the following:
Convert your font file to an image
Store each character as a VAO (use a loop to store them all - array index = unicode number)
Use a sprite batch to draw the text whenever its needed
Below is a snippet of my Java sprite batching code, used to draw the text.
public void draw(final String text, final float sx, final float ...
If you cannot find a single font containing all glyphs you want, you will have to have multiple fonts.
Some text rasterisation APIs have "font linking" or "font substitution" in which they use more than one font as fallback for missing glyphs. This tends to result in a sub-optimal result in terms of character advances, relative glyph size, and kerning - but ...
Yes, Freetype is reasonable.
If you use .png files, you have to make one for EVERY size and EVERY color, and that may occupy 10 times the space a .ttf file takes up. Goodbye, free space on android and iOS devices. Moreover, you just have to get 1 .ttf file, and that's it. Hope I helped you!
I believe this could be an issue with the AssetManager as it uses an objectMap which maps loaded objects to the string used to load them. In this case you're loading the font and the assetManager is storing it in it's objectMap under the key "fonts/Roboto-Regular.ttf", then when you load your font again with second set of parameters the previous font is ...
The intent of Condition #5 of the Open Font License seems to simply be to clarify the following:
You do need to provide this license alongside your usage of the font, but
This license applies just to the font, and doesn't affect whatever you're using the font to produce.
In other words, the license is clarifying that it is not a viral license such as the ...
It seems that something is going wrong when you create the textures for the individual characters. First, if we look closely, we see that it's not just the o, g and 3 characters are badly positioned:
As Petr Abdulin points out:
The base coordinate for your sprites is "left,bottom" (classic
which is correct. Your renderer assumes left,top ...
I can't add a comment because my reputation isn't high enough, so this isn't really an answer.
I thought the o's were offset differently as well, but when I used a ruler it turns out all three o's are on the same baseline. It is just an optical illusion from the dropped 'm'.
In you code sample for extracting the glyphs from the font texture you use the ...
It looks like you are using a scale camera for your game objects (the grid). That's fine. However fonts in libgdx are scaled in pixel dimensions and not your game world units. The best course of action here is to maintain two sperate cameras to render your game: world, and ui.
The world camera will be in your world units as you have it now. The ui camera ...
AFAIK there is no possibility to do that. But when you take a look into a .fnt file, you'll see that it's possible to write it on your own. It's made of some lines of plain-text which are doable in a hour or so i guess.
So the only solution that comes to my mind is writing the .fnt yourself.
EDIT: the resource you have there (this one) contains actually ...
Do you know how to implement sprites? If yes, then drawing text from a character sheet is easy: just treat each character as a sprite and draw them one after the other.
The details depend on the font you have and on how fancy you want your typography to be. Obviously, the simplest case would be a monospace font, where each character is a constant-size ...
The way outline fonts (such as ttf) work is by defining a set of curves by vector graphics (quadratic Bézier in the case of ttf).
What is inside or outside? At the moment of rendering the target area has a set of pixel where the character will be drawn. The following is a simplification of the algorithm to do so:
Go row by row:
Start by considering we are ...
You need to input intended character widths, but not necessarily in a separate text file: the image itself can contain graphical markers at the boundaries of character sprites.
For example, you can put all characters next to each other, left to right, and add an extra row to the image that contains a colored pixel in the leftmost column of each character ...
It actually looks like you are already on the right track with your comments.
Try changing your font initialisation to this:
//scale desired size 25 by density
int fontSize = (int) (25 * density);
//define texture for font with BILINEAR scaling
final ITexture fontTexture = new BitmapTextureAtlas(this.getTextureManager(), 1024, 1024, TextureOptions.BILINEAR)...
There are a few methods I used which worked in the past, each has their own pros and cons.
The first was to generate about 10 different sizes of fonts in Heiro as part of a single atlas. I then import each of them in a static Assets class which I use to access assets throughout my game. When I want to draw text of a certain size, I call a static method of ...
I see you use gridSprite.setSize(SIZE, SIZE);//4x4. That means that your sprite uses 4x4 units of your camera's viewportWidth and viewportHeight for drawing. And that means, that your world is scaled. If you were using viewportWidth and viewportHeight set to screen resolution in pixels, then text will be all right. But when the world is scaled, viewportWidth ...
Try Freetype OpenGL, a library for displaying a unicode text using a (single) vertex buffer and freetype fonts. Have a look at their web, repository and documentation.
An example, from their website:
/* Text to be printed */
wchar_t *text = L"A Quick Brown Fox Jumps Over The Lazy Dog 0123456789";
/* Texture atlas to store individual glyphs */
The characters in such a monospace font are ordered in increasing ASCII codepoint row-major order.
This means that you can derive the cell offset by simple arithmetic. Given the codepoint base of the top left character, the cell index col,row of a codepoint ch is:
col= (ch-base) % columns
row= (ch-base) / columns
You can then compute X and Y of the ...
The XNA SpriteFont class uses the SpriteBatch and Texture2Ds to back it. Just as when you render any other Texture2D if you use vectors with non whole numbers XNA samples the overlapping source pixels leasing to the unexpected behavior you are experiencing.
To avoid the issue make sure the the you use whole numbers when assigning the location so that the ...