Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 5 of 6 FirstFirst ... 3456 LastLast
Results 41 to 50 of 55

Thread: Fontmaps

  1. #41
    Member Regular Contributor
    Join Date
    Jan 2005
    Location
    USA
    Posts
    411
    Quote Originally Posted by thokra View Post
    OT: So, you want participation without qualification? Don't we have enough Romneys already?
    Well for the record what I was trying to say is even immature and impractical people are allowed to be mean on the internet. Inclusion and participation is usually a good thing; except when it's participation in generally intolerant and psychopathic behavior. I don't think Romney believes in participation since he participated in a debate the other night that excluded candidates that are on the ballot in most of the states he would like to represent in the executive office. Funny that's the same reason I can't in good conscience participate in voting for our presidents. So I guess that makes me unqualified to be a citizen. Still I participate. Who in their right mind thinks about such things much less drags them into online discussion forums I wonder...

    The nice thing about online forums is no matter how ugly the baring of teeth no one has yet to die at the hands of a crazed gunman mid post. Most of the meanness you find online is probably just a reflection of the pure frustrated impotency you are faced with when you try to lash out violently at a computer monitor

    Some symbols are kind of "associative" in that they stick to other symbols. I am yet unsure if my fontmap will be able to represent those symbols, for I haven't made much research on that.
    Those would have to be composited. But by god if you are loading up Pango surely it is able to do all of the necessary drawing?!
    God have mercy on the soul that wanted hard decimal points and pure ctor conversion in GLSL.

  2. #42
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,099
    OT: This forum isn't about tolerance or acceptance. It's about helping people with questions regarding OpenGL or topics connected to OpenGL. If in the course of answering a question, or participation in a discussion spawned by said question, you come up with incorrect statements, you should correct that sentence yourself or at least have the decency to accept corrections from others. That's the only reason why I cam up with the new network comparison. Since I polluted this thread enough with my perceived rants I'm simply gonna stop here with the suggestion, that in the future you either research stuff that you want to comment on, say that you don't know about something if you can't answer a question, or simply don't say anything at all. Thanks.

  3. #43
    Junior Member Newbie
    Join Date
    Aug 2012
    Posts
    23
    Quote Originally Posted by michagl View Post
    Those would have to be composited. But by god if you are loading up Pango surely it is able to do all of the necessary drawing?!
    Where is the fun in doing things like every other bloke? I want to see if my fontmap is possible, for it should theoretically perform much better. I will obviously use Pango itself to render text if I find the fontmap to be impractical or broken.

  4. #44
    Junior Member Newbie
    Join Date
    Aug 2012
    Posts
    23
    Success, brothers!



    The color is (0.15, 0.15, 0.15) so the contrast isn't that painful on the eyes. What do you guys think, could you read text like this without problems?

    I have had no luck finding the function with which to set the filtering, so I assume it's some antialias_gridfit one - I'd like the subpixel one (I think it would make the text less painful to read). Does anyone know where I might look?

  5. #45
    Junior Member Newbie
    Join Date
    Aug 2012
    Posts
    23
    Here's how it looks after a complete rewrite (word-wrapping words but not spaces, some optimizations) if anyone still cares.



    This is how the quads are positioned: http://imageshack.us/a/img855/5263/screen2ds.png
    Last edited by Inagawa; 10-07-2012 at 08:59 AM.

  6. #46
    Member Regular Contributor
    Join Date
    Jan 2005
    Location
    USA
    Posts
    411
    Quote Originally Posted by thokra View Post
    OT: This forum isn't about tolerance or acceptance. It's about helping people with questions regarding OpenGL or topics connected to OpenGL. If in the course of answering a question, or participation in a discussion spawned by said question, you come up with incorrect statements, you should correct that sentence yourself or at least have the decency to accept corrections from others. That's the only reason why I cam up with the new network comparison. Since I polluted this thread enough with my perceived rants I'm simply gonna stop here with the suggestion, that in the future you either research stuff that you want to comment on, say that you don't know about something if you can't answer a question, or simply don't say anything at all. Thanks.
    Who was it that brought it up? I am just trying to fit in. You will survive either way
    God have mercy on the soul that wanted hard decimal points and pure ctor conversion in GLSL.

  7. #47
    Member Regular Contributor
    Join Date
    Jan 2005
    Location
    USA
    Posts
    411
    Quote Originally Posted by Inagawa View Post
    Here's how it looks after a complete rewrite (word-wrapping words but not spaces, some optimizations) if anyone still cares.



    This is how the quads are positioned: http://imageshack.us/a/img855/5263/screen2ds.png
    Yeah I care of course. But I can only make a point to read this forum off and on. So this is using your customized technique? Or Pango? Does Pango let you only load the pieces (library modules) you need?

    So it looks like you are aiming for either a text editor or a very wordy game or reader or something?
    God have mercy on the soul that wanted hard decimal points and pure ctor conversion in GLSL.

  8. #48
    Junior Member Newbie
    Join Date
    Aug 2012
    Posts
    23
    It's the result of this code:

    _renderer = new Renderer(this, 6500);
    _renderer.MapBuffer();

    var fontMap = new FontMap(_renderer, new Size(512, 512));
    fontMap.AddGlyphSet(FontMap.BasicLatin, "Times New Roman", 10, Style.Normal, Weight.Normal, Underline.None);
    fontMap.AddGlyphSet(FontMap.BasicLatin, "Times New Roman", 16, Style.Normal, Weight.Normal, Underline.None);
    fontMap.GenerateFontMap();

    // Renderer, FontMap, MaxWidth, MaxHeight, FontName, FontSize, FontStyle, FontWeight, FontUnderline, PosX|Y|Z
    _block = new Block(_renderer, fontMap, 790, 600, "Times New Roman", 16, Style.Normal, Weight.Normal, Underline.None, 0, 0, 0);
    _block.SetText(Text, Block.Alignment.Center);
    So, basically the fontmap uses Pango to paint all the glyphs that you need (e.g., FontMap.BasicLatin) into a dynamically managed buffer.
    The rendered glyphs are sorted with an offshoot of the Cygon Bin Packer and then an opengl texture is generated with "GenerateFontMap()" call.

    Well, after generating the texture you can access any glyph information by calling

    glyphInfo = _fontMap.GetGlyph(Character, FontName, Size, Style, Weight, Underline);
    The glyphInfo contains everything you need to successfully render a single glyph (e.g., position on the texture, index of the texture, bearingX|Y, advanceX|Y, etc).

    It's quite neat, but the dependency on Mono makes it all quite ... distasteful. On the other hand, I doubt you'll find faster dynamic text. Sure it may suffer against static text, but for my uses this was what I needed.

  9. #49
    Member Regular Contributor
    Join Date
    Jan 2005
    Location
    USA
    Posts
    411
    ^Can comment on which constructs in the code above belong to what libraries?

    PS: I've subscribed to this thread (should have already) just now and will make a point to report back here after I am able to figure the best solution for my needs. I recommend anyone who wants to hear what I come up with subscribe too because it may well come a year from now

    My hope is to come up with something that apes DrawText in ease of use but is portable and serves as many non-proprietary (or de facto so) fonts as possible be they compatible with DrawText or not. It's a nut I will have to crack sooner or later if a proper solution doesn't boil up in the meantime. My theory is rendering text for things like games should be brain dead simple regardless of your platform.
    God have mercy on the soul that wanted hard decimal points and pure ctor conversion in GLSL.

  10. #50
    Junior Member Newbie
    Join Date
    Aug 2012
    Posts
    23
    The Renderer uses only OpenTK, FontMap uses OpenTK, Pango and Cairo. The block closely uses FontMap. I can PM you the source to the classes you want to see, or I can post them here if anyone else is interested. But as you know, it's all in C# (and I guess all of you are using C++).

    Also, this is by no means completed. As far as fontmap generating goes, the GDI-based fontmap supports all installed fonts and fonts from file and memory. It's also able (thanks to GDI+) to render glyphs from other fonts if they don't exist in the specified font. The downside are the simulated glyph metrics. Since I had to fake them, the text isn't aligned very well (the reason I abandoned it, after all). The Pango-based fontmap only supports installed fonts and cannot substitute glyphs, but has better quality of text and pixel-perfect glyph alignment. It is also much more memory efficient and 10x faster.

    The Block is programmed to work with the newer, Pango-based fontmap, but it's easy to use it with the older fontmap.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •