• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
FireInDark

Some questions about FreeType..

2 posts in this topic

First:
FT_Render_Glyph(face->glyph,FT_Render_Mode::FT_RENDER_MODE_NORMAL);
After that how should I get every pixel mask as RGBA..
I realy don't know how to deal with th data with FT_Bitmap.buffer...

Next:
face->glyph->metrics.width ;
face->glyph->metrics.height;
face->glyph->metrics.horiBearingX;
face->glyph->metrics.horiAdvance;
FT_Bitmap bitmap;
bitmap.rows;
bitmap.width;

I think I've understand the member data of face->glyph->metrics;
But how should I understand bitmap.rows and the width;

Then I will express my question with a picture..[attachment=10145:GAME.png]
there are tow box ( a and b ,as you can see I write it with the mouse ) bounding the charactor "a" (ingore the "M"),wicth of the box really express the FT_Bitmap?

Thanks anyway.
0

Share this post


Link to post
Share on other sites
The bitmap structure is box b in your image. The following six values are needed to align and render the glyph bitmaps correctly on a horizontal baseline:[list=1]
[*]glyph->bitmap.width is the width of the glyph bitmap in pixels.
[*]glyph->bitmap.height is the height of the glyph bitmap in pixels.
[*]glyph->bitmap.pitch is the size of one scanline of the glyph bitmap in bytes.
[*]glyph->left is the x-origin of the bitmap in pixels.
[*]glyph->top is the y-origin of the bitmap in pixels.
[*]glyph->advance.x is the horizontal advance in font units.
[/list]
Point 1 and 2 is simply the size of the bitmap: loop over both width and height to access each pixel.
Point 3 is for row-alignment: each new row of the bitmap starts pitch bytes from the start of the previous row. Since each row may end with some extra bytes that are not part of the bitmap image itself, the pitch takes this into account but width does not.
Point 4 and 5 is the vertical and horizontal offsets you need to shift the bitmaps location on the screen by in order to correctly align it on the baseline. For example, a glyph like 'g' or 'j' extends below the baseline, so it has to be shifted down, you cannot align the bottom of the bitmap to the baseline in these cases.
Point 6 is determines how far along the baseline to advance the drawing position for each glyph you draw. This value is in font units and not pixels, and has to be converted to pixels. From what I remembered, "font units" was a very vague terms and could mean different things depending on the actual font you have loaded. My experience is that it's mostly a fixed point value with 6 fractional bits, so right-shift the advance.x value 6 bits to obtain a pixel value.

Last but not least, you of course need glyph->bitmap.buffer which is the pointer to the top left corner of the glyph image data. When you render with FT_RENDER_NORMAL, you get an antialiased grey scale image. Thus, each pixel consists of one byte representing the grey scale level of the pixel.
2

Share this post


Link to post
Share on other sites
[quote name='Brother Bob' timestamp='1342775503' post='4961236']
The bitmap structure is box b in your image. The following six values are needed to align and render the glyph bitmaps correctly on a horizontal baseline:
glyph->bitmap.width is the width of the glyph bitmap in pixels.
glyph->bitmap.height is the height of the glyph bitmap in pixels.
glyph->bitmap.pitch is the size of one scanline of the glyph bitmap in bytes.
glyph->left is the x-origin of the bitmap in pixels.
glyph->top is the y-origin of the bitmap in pixels.
glyph->advance.x is the horizontal advance in font units.
Point 1 and 2 is simply the size of the bitmap: loop over both width and height to access each pixel.
Point 3 is for row-alignment: each new row of the bitmap starts pitch bytes from the start of the previous row. Since each row may end with some extra bytes that are not part of the bitmap image itself, the pitch takes this into account but width does not.
Point 4 and 5 is the vertical and horizontal offsets you need to shift the bitmaps location on the screen by in order to correctly align it on the baseline. For example, a glyph like 'g' or 'j' extends below the baseline, so it has to be shifted down, you cannot align the bottom of the bitmap to the baseline in these cases.
Point 6 is determines how far along the baseline to advance the drawing position for each glyph you draw. This value is in font units and not pixels, and has to be converted to pixels. From what I remembered, "font units" was a very vague terms and could mean different things depending on the actual font you have loaded. My experience is that it's mostly a fixed point value with 6 fractional bits, so right-shift the advance.x value 6 bits to obtain a pixel value.

[/quote]
Thank you very much for your reply .
It's useful for me ...
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0