Hello community, here is the log from the commit of package font-specimen for openSUSE:Factory checked in at 2014-12-10 23:44:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/font-specimen (Old) and /work/SRC/openSUSE:Factory/.font-specimen.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "font-specimen" Changes: -------- --- /work/SRC/openSUSE:Factory/font-specimen/font-specimen.changes 2014-11-15 12:15:13.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.font-specimen.new/font-specimen.changes 2014-12-10 23:44:42.000000000 +0100 @@ -1,0 +2,22 @@ +Tue Dec 2 16:03:03 UTC 2014 - [email protected] + +- update to 20141202 + * fix bgr layout + * fix vertical layouts + * add *.pc file + +------------------------------------------------------------------- +Mon Dec 1 18:08:30 UTC 2014 - [email protected] + +- update to 20141201 + * correct color rendering + +------------------------------------------------------------------- +Sat Nov 29 18:16:53 UTC 2014 - [email protected] + +- update to 20141129 + * half way to correct color rendering + * fix error handling + * other minor fixes + +------------------------------------------------------------------- Old: ---- font-specimen-20141113.tar.bz2 New: ---- font-specimen-20141202.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ font-specimen.spec ++++++ --- /var/tmp/diff_new_pack.LV4s3u/_old 2014-12-10 23:44:43.000000000 +0100 +++ /var/tmp/diff_new_pack.LV4s3u/_new 2014-12-10 23:44:43.000000000 +0100 @@ -18,7 +18,7 @@ %define libmaj 0 Name: font-specimen -Version: 20141113 +Version: 20141202 Release: 0 Summary: Font Specimen Creator License: GPL-2.0+ @@ -66,6 +66,7 @@ export INCLUDEDIR="%{_includedir}" export LIBDIR="%{_libdir}" export BINDIR="%{_bindir}" +export PKG_CONFIG_DIR="%{_datadir}/pkgconfig" make DESTDIR=%{buildroot} install %{?_smp_mflags} %post -n libfont-specimen%{libmaj} -p /sbin/ldconfig @@ -85,5 +86,6 @@ %defattr(-,root,root) %{_includedir}/* %{_libdir}/libfont-specimen.so +%{_datadir}/pkgconfig/%{name}.pc %changelog ++++++ font-specimen-20141113.tar.bz2 -> font-specimen-20141202.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/font-specimen-20141113/ChangeLog new/font-specimen-20141202/ChangeLog --- old/font-specimen-20141113/ChangeLog 2014-11-13 12:41:05.000000000 +0100 +++ new/font-specimen-20141202/ChangeLog 2014-12-02 17:22:36.000000000 +0100 @@ -1,3 +1,7 @@ +2014-12-02 fix bgr layout + fix vertical layout + add font-specimen.pc file +2014-12-01 allow color specimen 2014-11-13 monochrome fonts: black absorbs gray color on the pixel, not vice versa 2014-07-11 font-specimen library created diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/font-specimen-20141113/Makefile new/font-specimen-20141202/Makefile --- old/font-specimen-20141113/Makefile 2014-11-13 12:41:05.000000000 +0100 +++ new/font-specimen-20141202/Makefile 2014-12-02 17:22:36.000000000 +0100 @@ -19,7 +19,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -VERSION = 20141113 +VERSION = 20141202 LIBRARY_NAME = font-specimen LIBRARY_MAJOR = 0 LIBRARY_VERSION = 0.0.0 @@ -42,7 +42,7 @@ font-specimen: font-specimen.c .libs/$(LIBRARY_FILE) gcc -L.libs $(MYCFLAGS) $(CFLAGS) $(MYLDFLAGS) $(LDLAGS) -o font-specimen font-specimen.c -l$(LIBRARY_NAME) -.libs/$(LIBRARY_FILE): $(OBJS) +.libs/$(LIBRARY_FILE): $(OBJS) font-specimen.pc mkdir -p .libs gcc $(MYCFLAGS) $(CFLAGS) -shared -Wl,-soname,${LIBRARY_LINK}.$(LIBRARY_MAJOR) -o .libs/$(LIBRARY_FILE) $(OBJS) $(MYLIBS) ln -sf $(LIBRARY_FILE) .libs/$(LIBRARY_LINK) @@ -69,10 +69,14 @@ cd unicode; cat Scripts.txt | sh scripts-map.sh > scripts-map.txt; cat Scripts.txt Blocks.txt | sh collections-map.sh >> scripts-map.txt; unicode/blocks-map.txt: unicode/Blocks.txt unicode/blocks.sh cd unicode; cat Blocks.txt | sh blocks.sh > blocks-map.txt - - +font-specimen.pc: font-specimen.pc.in + cp -f font-specimen.pc.in font-specimen.pc + sed -i "s:@VERSION@:$(VERSION):" font-specimen.pc + sed -i "s:@INCLUDEDIR@:$(INCLUDEDIR):" font-specimen.pc + sed -i "s:@LIBDIR@:$(LIBDIR):" font-specimen.pc + sed -i "s:@LIBS@:-l$(LIBRARY_NAME):" font-specimen.pc clean: - rm -rf *.o font-specimen unicode/scripts.txt unicode/scripts-map.txt .libs + rm -rf *.o font-specimen unicode/scripts.txt unicode/scripts-map.txt .libs font-specimen.pc install: font-specimen mkdir -p $(DESTDIR)/$(INCLUDEDIR) @@ -83,10 +87,12 @@ ln -sf $(LIBRARY_FILE) $(DESTDIR)/$(LIBDIR)/$(LIBRARY_LINK) mkdir -p -m 0755 $(DESTDIR)/$(BINDIR) install -m 0755 font-specimen $(DESTDIR)/$(BINDIR) + mkdir -p $(DESTDIR)/$(PKG_CONFIG_DIR) + install -m 0644 font-specimen.pc $(DESTDIR)/$(PKG_CONFIG_DIR) release: font-specimen mkdir -p $(LIBRARY_NAME)-$(VERSION) - cp -r *.c *.h Makefile $(LIBRARY_NAME)-$(VERSION) + cp -r *.c *.h Makefile font-specimen.pc.in $(LIBRARY_NAME)-$(VERSION) mkdir -p $(LIBRARY_NAME)-$(VERSION)/unicode for f in $(UNICODE_SOURCES) $(UNICODE_SCRIPTS); do \ cp unicode/$$f $(LIBRARY_NAME)-$(VERSION)/unicode; \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/font-specimen-20141113/font-specimen.pc.in new/font-specimen-20141202/font-specimen.pc.in --- old/font-specimen-20141113/font-specimen.pc.in 1970-01-01 01:00:00.000000000 +0100 +++ new/font-specimen-20141202/font-specimen.pc.in 2014-12-02 17:22:36.000000000 +0100 @@ -0,0 +1,12 @@ +libdir=@LIBDIR@ +includedir=@INCLUDEDIR@ +version = @VERSION@ +libs = @LIBS@ + +Name: font-specimen +Version: ${version} +Description: Font Specimens Library +URL: https://github.com/pgajdos/font-specimen +Libs: -L${libdir} ${libs} +Cflags: -I${includedir} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/font-specimen-20141113/ft.c new/font-specimen-20141202/ft.c --- old/font-specimen-20141113/ft.c 2014-11-13 12:41:05.000000000 +0100 +++ new/font-specimen-20141202/ft.c 2014-12-02 17:22:36.000000000 +0100 @@ -49,12 +49,19 @@ return string; } -int ft_initialize_bitmap(bitmap_t *bitmap, int height, int width) +int ft_initialize_bitmap(bitmap_t *bitmap, int height, int width, + int ord, int lcdfilter) { int row; FT_Error err; + if (lay_horizontal(ord)) + width *= 3; + + if (lay_vertical(ord)) + height *= 3; + bitmap->data = (unsigned char **)malloc(height*sizeof(unsigned char *)); if (! bitmap->data) { @@ -85,6 +92,34 @@ bitmap->face = NULL; + bitmap->load_flags = FT_LOAD_DEFAULT; + bitmap->render_mode = FT_RENDER_MODE_NORMAL; + + /* these are common for whole specimen image */ + if (lay_color(ord)) + { + err = FT_Library_SetLcdFilter(bitmap->library, lcdfilter); + if (err) + { + font_specimen_error("freetype: can not set lcd filter"); + return -1; + } + + if (lay_horizontal(ord)) + { + bitmap->load_flags |= FT_LOAD_TARGET_LCD; + bitmap->render_mode = FT_RENDER_MODE_LCD; + } + + if (lay_vertical(ord)) + { + bitmap->load_flags |= FT_LOAD_TARGET_LCD_V; + bitmap->render_mode = FT_RENDER_MODE_LCD_V; + } + } + + bitmap->ord = ord; + return 0; } @@ -102,8 +137,6 @@ FcBool antialias; int hintstyle; FcBool embeddedbitmaps; - int subpixel_layout; - int lcdfilter; const char *family; const char *style; @@ -182,21 +215,20 @@ if (fontconfig_pattern_get_bool(pattern, FC_SCALABLE, &scalable) < 0) return -1; - bitmap->load_flags = FT_LOAD_DEFAULT; - bitmap->render_mode = FT_RENDER_MODE_NORMAL; - if (scalable) { - if (fontconfig_pattern_get_bool(pattern, FC_ANTIALIAS, &antialias) < 0 || - fontconfig_pattern_get_bool(pattern, FC_HINTING, &hinting) < 0 || - fontconfig_pattern_get_bool(pattern, FC_AUTOHINT, &autohint) < 0 || - fontconfig_pattern_get_integer(pattern, FC_HINT_STYLE, &hintstyle) < 0 || - fontconfig_pattern_get_bool(pattern, FC_EMBEDDED_BITMAP, &embeddedbitmaps) < 0 || - fontconfig_pattern_get_integer(pattern, FC_RGBA, &subpixel_layout) < 0 || - fontconfig_pattern_get_integer(pattern, FC_LCD_FILTER, &lcdfilter) < 0) - return -1; + if (fontconfig_pattern_get_bool(pattern, FC_ANTIALIAS, &antialias) < 0) + antialias = FcTrue; + if (fontconfig_pattern_get_bool(pattern, FC_HINTING, &hinting) < 0) + hinting = FcTrue; + if (fontconfig_pattern_get_bool(pattern, FC_AUTOHINT, &autohint) < 0) + autohint = FcTrue; + if (fontconfig_pattern_get_integer(pattern, FC_HINT_STYLE, &hintstyle) < 0) + hintstyle = FC_HINT_MEDIUM; + if (fontconfig_pattern_get_bool(pattern, FC_EMBEDDED_BITMAP, &embeddedbitmaps) < 0) + embeddedbitmaps = FcTrue; - if (!antialias) + if (!lay_color(bitmap->ord) && !antialias) { bitmap->render_mode = FT_RENDER_MODE_MONO; bitmap->load_flags |= FT_LOAD_TARGET_MONO; @@ -227,28 +259,6 @@ if (text_direction >= 2) bitmap->load_flags |= FT_LOAD_VERTICAL_LAYOUT; - bitmap->ord = ORD_GRAY; - if (0 < subpixel_layout && subpixel_layout < 5) - { - FT_Library_SetLcdFilter(bitmap->library, lcdfilter); - - bitmap->ord = ORD_RGB; - if (subpixel_layout == 2 || subpixel_layout == 4) - bitmap->ord = ORD_BGR; - } - - if (subpixel_layout == 1 || subpixel_layout == 2) - { - bitmap->load_flags |= FT_LOAD_TARGET_LCD; - bitmap->render_mode = FT_RENDER_MODE_LCD; - } - - if (subpixel_layout == 3 || subpixel_layout == 4) - { - bitmap->load_flags |= FT_LOAD_TARGET_LCD_V; - bitmap->render_mode = FT_RENDER_MODE_LCD_V; - } - return 0; } @@ -291,8 +301,15 @@ int monochrome) { FT_Int i, j, p, q; - FT_Int x_max = x + glyph->width; - FT_Int y_max = y + glyph->rows; + FT_Int x_max, y_max; + + if (lay_horizontal(bitmap.ord)) + x *= 3; + if (lay_vertical(bitmap.ord)) + y *= 3; + + x_max = x + glyph->width; + y_max = y + glyph->rows; for (i = x, p = 0; i < x_max; i++, p++) { @@ -311,7 +328,7 @@ } else { - bitmap.data[j][i] &= ~((char)((int)glyph->buffer[q * glyph->width + p]*bitmap.grayscale/100)); + bitmap.data[j][i] &= ~((char)((int)glyph->buffer[q * glyph->pitch + p]*bitmap.grayscale/100)); } } } @@ -330,7 +347,7 @@ { bitmap_t bitmap; int len; - if (ft_initialize_bitmap(&bitmap, 0, 0) < 0) + if (ft_initialize_bitmap(&bitmap, 0, 0, FC_RGBA_UNKNOWN, FC_LCD_NONE) < 0) return -1; if (ft_bitmap_set_font(&bitmap, pattern, pxsize, 1.0, dir, script, lang) < 0) @@ -360,6 +377,7 @@ FT_Vector *glyph_advances; FT_Vector *glyph_positions; FT_Glyph *glyphs; + FT_BitmapGlyph bit; int monochrome; int nglyphs, g; @@ -433,9 +451,11 @@ for (g = 0; g < nglyphs; g++) { monochrome = 0; - if (bitmap->load_flags & FT_LOAD_TARGET_MONO || + if (bitmap->render_mode == FT_RENDER_MODE_MONO || glyphs[g]->format == FT_GLYPH_FORMAT_BITMAP) + { monochrome = 1; + } err = FT_Glyph_To_Bitmap(&glyphs[g], bitmap->render_mode, NULL, 1); @@ -445,12 +465,13 @@ return -1; } - FT_BitmapGlyph bit; bit = (FT_BitmapGlyph)glyphs[g]; draw_bitmap(&bit->bitmap, glyph_positions[g].x + bit->left, glyph_positions[g].y - bit->top, *bitmap, monochrome); + + } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/font-specimen-20141113/ft.h new/font-specimen-20141202/ft.h --- old/font-specimen-20141113/ft.h 2014-11-13 12:41:05.000000000 +0100 +++ new/font-specimen-20141202/ft.h 2014-12-02 17:22:36.000000000 +0100 @@ -31,12 +31,10 @@ #include FT_FREETYPE_H #include FT_LCD_FILTER_H -typedef enum -{ - ORD_GRAY, - ORD_RGB, - ORD_BGR -} sp_ord_t; +#define lay_color(ord) (FC_RGBA_UNKNOWN < ord && ord < FC_RGBA_NONE) +#define lay_horizontal(ord) (ord == FC_RGBA_RGB || ord == FC_RGBA_BGR) +#define lay_vertical(ord) (ord == FC_RGBA_VRGB || ord == FC_RGBA_VBGR) +#define lay_bgr(ord) (ord == FC_RGBA_BGR || ord == FC_RGBA_VBGR) typedef struct { @@ -54,12 +52,13 @@ const char *lang; FT_Int32 load_flags; FT_Render_Mode render_mode; - sp_ord_t ord; + int ord; } bitmap_t; /* pxsize == 0 -> don't initialize face */ char *freetype_version(char *string, int maxlen); -int ft_initialize_bitmap(bitmap_t *bitmap, int height, int width); +int ft_initialize_bitmap(bitmap_t *bitmap, int height, int width, + int ord, int lcdfilter); int ft_bitmap_set_font(bitmap_t *bitmap, FcPattern *pattern, int pxsize, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/font-specimen-20141113/img_png.c new/font-specimen-20141202/img_png.c --- old/font-specimen-20141113/img_png.c 2014-11-13 12:41:05.000000000 +0100 +++ new/font-specimen-20141202/img_png.c 2014-12-02 17:22:36.000000000 +0100 @@ -21,6 +21,7 @@ */ #include <png.h> +#include <stdio.h> #include "img_png.h" #include "ft.h" @@ -40,7 +41,7 @@ int p; char tmp; - if (len % 3 == 0) + if (len % 3 != 0) { font_specimen_error("img_png: bitmap lenght of row is not multiple of 3"); return NULL; @@ -57,15 +58,20 @@ int img_png_write(FILE *png, bitmap_t bitmap) { - int j; + int i, j, png_width, png_height; png_structp png_ptr; png_infop info_ptr; - unsigned char row[bitmap.height]; + int row_len = lay_vertical(bitmap.ord) ? 3*bitmap.width : bitmap.width; + unsigned char row[row_len]; + + + png_width = lay_horizontal(bitmap.ord) ? bitmap.width / 3 : bitmap.width; + png_height = lay_vertical(bitmap.ord) ? bitmap.height / 3 : bitmap.height; png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (png_ptr == NULL) { - font_specimen_error("img_png: can nott create write structure"); + font_specimen_error("img_png: can not create write structure"); return -1; } @@ -84,34 +90,46 @@ png_init_io(png_ptr, png); - if (bitmap.ord == ORD_GRAY) + if (lay_color(bitmap.ord)) { - png_set_IHDR(png_ptr, info_ptr, bitmap.width, bitmap.height, - 8, PNG_COLOR_TYPE_GRAY, PNG_INTERLACE_NONE, + png_set_IHDR(png_ptr, info_ptr, png_width, png_height, + 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); } else { - png_set_IHDR(png_ptr, info_ptr, bitmap.width, bitmap.height, - 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, + png_set_IHDR(png_ptr, info_ptr, png_width, png_height, + 8, PNG_COLOR_TYPE_GRAY, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); } png_write_info(png_ptr, info_ptr); for (j = 0; j < bitmap.height; j++) { - if (bitmap.ord == ORD_BGR) + if (lay_vertical(bitmap.ord)) { - memcpy(bitmap.data[j], row, bitmap.height); - if (swapRB(row, bitmap.height) == NULL) - return -1; - png_write_row(png_ptr, row); + for (i = 0; i < bitmap.width; i++) + { + row[3*i] = bitmap.data[j ][i]; + row[3*i + 1] = bitmap.data[j + 1][i]; + row[3*i + 2] = bitmap.data[j + 2][i]; + } + j += 2; } else { - png_write_row(png_ptr, bitmap.data[j]); + memcpy(row, bitmap.data[j], row_len); } + + if (lay_bgr(bitmap.ord)) + { + if (swapRB(row, row_len) == NULL) + return -1; + } + + png_write_row(png_ptr, row); } + png_write_end(png_ptr, NULL); png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/font-specimen-20141113/specimen.c new/font-specimen-20141202/specimen.c --- old/font-specimen-20141113/specimen.c 2014-11-13 12:41:05.000000000 +0100 +++ new/font-specimen-20141202/specimen.c 2014-12-02 17:22:36.000000000 +0100 @@ -184,6 +184,10 @@ } len = ft_text_length(string, pattern, sizes[nsizes-1], dir, script, lang); + + if (len < 0) + return -1; + if (dir < 2) { if (!*width) @@ -221,7 +225,8 @@ return -2; } - for (i = 0; i < nsizes; i++) + i = 0; + while (1) { (*strings)[i].sentence = string; (*strings)[i].x = x; @@ -233,10 +238,13 @@ (*strings)[i].dir = dir; (*strings)[i].grayscale = 100; + if (++i == nsizes) + break; + if (dir < 2) - y += sizes[i+1] + strings_dist; + y += sizes[i] + strings_dist; else - x += sizes[i+1] + strings_dist; + x += sizes[i] + strings_dist; } /* gray big on the background */ @@ -323,6 +331,7 @@ int tmp; bitmap_t bitmap; + int ord, lcdfilter; int t; specimen_string_t *strings; @@ -330,9 +339,9 @@ const char *rendering_options_bool[] = { FC_ANTIALIAS, FC_HINTING, FC_AUTOHINT, - FC_LCD_FILTER, NULL }; const char *rendering_options_int[] = { FC_HINT_STYLE, + FC_LCD_FILTER, FC_RGBA, FC_EMBEDDED_BITMAP, NULL }; @@ -354,10 +363,11 @@ o++; } + o = 0; while (rendering_options_int[o]) { - if (fontconfig_pattern_get_bool(pat, rendering_options_int[o], &value) == 0) - fontconfig_pattern_set_bool(fnt, rendering_options_int[o], value); + if (fontconfig_pattern_get_integer(pat, rendering_options_int[o], &value) == 0) + fontconfig_pattern_set_integer(fnt, rendering_options_int[o], value); o++; } fontconfig_pattern_destroy(pat); @@ -405,7 +415,14 @@ return -1; } - if (ft_initialize_bitmap(&bitmap, height, width) < 0) + if (fontconfig_pattern_get_integer(fnt, FC_RGBA, &ord) < 0) + ord = FC_RGBA_UNKNOWN; + if (fontconfig_pattern_get_integer(fnt, FC_LCD_FILTER, &lcdfilter) < 0) + lcdfilter = FC_LCD_NONE; + + lcdfilter = (lcdfilter != 3 ? lcdfilter : 16); + + if (ft_initialize_bitmap(&bitmap, height, width, ord, lcdfilter) < 0) return -1; for (t = 0; t < nstrings; t++) -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
