Hot answers tagged

17

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 ...


16

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. For example. Developing on 2560x1440 with font size 16 and running on 1920x1080. Font size will be: 1920 * 16 / 2560 = 12 I do the ...


13

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 ...


7

Flexible & Accurate: Filters Use a texel filter either on the texture on the CPU side, or if you are using programmable pipeline OpenGL, directly in the fragment shader. The idea of a filter is simply that you run through a 2D loop to process every texel. If it is white, then you run through an inner 2D loop for each of its surrounding pixels in some ...


6

This feature is implemented directly in FTGL but it is only available in the ExtrudeFont class. You simply define an outset for the font: font = new FTExtrudeFont(...); font->FaceSize(80); font->Depth(0); font->Outset(0, 5); Then you can use a different colour for the two render modes: glColor3f(1.0, 1.0, 1.0); /* White inside */ font->Render("...


5

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. EDIT 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 ...


5

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) batch.begin(); shapes.begin(); .. draw stuff from both ... shapes.end(); batch.end(); And from me - Don't use ShapeRenderer for drawing - it's for debugging purposes. Instead of this create a ...


5

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 ...


4

I haven't tried this out, so some experimentation would be needed to see if it actually works. What I would do: Start from a vectorized format that follows the drawing direction. As an example, the hershey fonts - the "scripts" and "scriptc" fonts might be a good starting point: Next, instead of drawing the fonts as line segments, render them as splines. ...


4

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): ...


4

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)


4

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 ...


4

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 ...


4

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!


4

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 ...


4

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 ...


3

If you are referring to your in-game fonts, you do not need to install the custom fonts in order to use them with your compiled game. When compiled, your fonts get converted to .XNB files, which are packaged in in your /bin directory and are used to draw in game.


3

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 ...


3

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 ...


3

Basically this is just a programming question if you abstract this out. If you really want to do this with sprite sheets, here's how I might do it in some quick JavaScript-style pseudocode... // ------------------------------------------------------------------------- // --- Array of sprite sheet offset for letter variants, indexed by letter // --- Note ...


3

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 ...


3

It's late in the day, but 71Squared has now released a command line app for Glyph Designer that allows you generate your font assets as part of your build process and also specify the size you would like, so you can automatically generate SD/HD output as required by your project. http://www.71squared.com/en/article/1979/introducing-glyph-designer-command-...


3

I don't know about the platform you're using, but there are mostly three ways to center text. Not all of them are available on all platforms, so you should check your platform documents and see which one of these is available. The font rendering system has a flag or option to draw centered text. Look for something like font.textAlignment. The font rendering ...


3

Don,t do any thing just set the scale of the font and it will work for all type of device font.setScale( .9f,.9f);


3

Unfortunately Monogame cannot (yet) generate XNB files so you will need to use the original content builder from XNA 4.0. You can use the libraries from https://msxna.codeplex.com/releases to install XNA on Visual Studio 2012 or 2013, so that you can use it with Windows 8.1.


3

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 ...


3

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 Cartesian) which is correct. Your renderer assumes left,top ...


3

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 ...


3

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 ...


2

You could determine the width of the text by the amount of characters of the string, its length, with constant values for the height and width of individual characters. This way, if you have a font in which, at a certain scale, letters have an average of 5 pixels of width, and you have a string of 4 characters (say, "1000"), the width of it would be 20 ...


Only top voted, non community-wiki answers of a minimum length are eligible