[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] GSoC-2017-kushal 48d9bb4 08/70: Loop across all glyphs
From: |
Kushal K S V S |
Subject: |
[freetype2] GSoC-2017-kushal 48d9bb4 08/70: Loop across all glyphs |
Date: |
Sun, 18 Mar 2018 11:21:09 -0400 (EDT) |
branch: GSoC-2017-kushal
commit 48d9bb4345026b6df5a35dfd6ecdac4047eab66c
Author: Kushal K S V S <address@hidden>
Commit: Kushal K S V S <address@hidden>
Loop across all glyphs
---
tests/make_png/make_png.c | 77 ++++++++++++++++++++++++-----------------------
1 file changed, 39 insertions(+), 38 deletions(-)
diff --git a/tests/make_png/make_png.c b/tests/make_png/make_png.c
index 27e81c5..099dbbc 100644
--- a/tests/make_png/make_png.c
+++ b/tests/make_png/make_png.c
@@ -26,7 +26,7 @@ int main (int argc, char const *argv[])
{
printf("\nTo generate 32-bit RGBA PNG(s) of all glyphs in a font\n");
printf("Images will be saved in a file named \n\
- $(font)_$(pt_size)_$(render_mode)_$(glyph_index).png \n\n");
+ $(font)_$(pt_size)_$(render_mode)_$(glyph_index).png \n\n");
printf("By default, hashes of 256-level gray bitmaps will be
generated\n\n");
@@ -126,47 +126,48 @@ int main (int argc, char const *argv[])
size,
render_type);
- for (i = 0; i <50; ++i)
+ for (i = 0; i <face->num_glyphs; ++i)
{
error = FT_Load_Glyph( face,
i,
load_flag | target_flag);
- if(error){
- printf("Error loading glyph\n");
- }
-
- FT_Render_Glyph( slot,
- render_flag);
- if(error){
- printf("Error rendering the glyph\n");
- }
-
- bitmap = &slot->bitmap;
-
- if (bitmap->width == 0 || bitmap->rows == 0)
- {
- continue;
- }
-
- FT_Bitmap target;
- FT_Bitmap_Init( &target );
-
- if (bitmap->pixel_mode == 1)
- {
- int alignment = 4;
- error = FT_Bitmap_Convert( library,
- bitmap,
- &target,
- alignment);
- if(error){
- printf("Error converting the bitmap\n");
- }
- Make_PNG(&target,name,i,render_mode);
-
- }else{
-
- Make_PNG(bitmap,name,i,render_mode);
- }
+ if(error){
+ printf("Error loading glyph\n");
+ }
+
+ FT_Render_Glyph( slot,
+ render_flag);
+ if(error){
+ printf("Error rendering the glyph\n");
+ }
+
+ bitmap = &slot->bitmap;
+
+ if (bitmap->width == 0 || bitmap->rows == 0)
+ {
+ continue;
+ }
+
+ FT_Bitmap target;
+ FT_Bitmap_Init( &target );
+
+ int alignment = 4;
+ error = FT_Bitmap_Convert( library,
+ bitmap,
+ &target,
+ alignment);
+ if(error){
+ printf("Error converting the bitmap\n");
+ }
+
+ if (render_mode == 0)
+ {
+ Make_PNG(&target,name,i,render_mode);
+
+ }else{
+
+ Make_PNG(bitmap,name,i,render_mode);
+ }
}
FT_Done_Face ( face );
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] GSoC-2017-kushal 48d9bb4 08/70: Loop across all glyphs,
Kushal K S V S <=