Enable bytecode interpreter

Enable bytecode interpreter (#547532).
Fall back to autohinting if a TTF/OTF doesn't contain any bytecode.
This commit is contained in:
Marek Kasik 2011-02-20 12:59:12 +01:00
parent abeaabaf87
commit c34d9460d8
3 changed files with 85 additions and 19 deletions

View File

@ -0,0 +1,77 @@
From ff8095077ce454246edb93c5bc672edb2b2c8f25 Mon Sep 17 00:00:00 2001
From: Kevin Kofler <kevin.kofler@chello.at>
Date: Sat, 19 Feb 2011 23:09:26 +0100
Subject: [PATCH] Fall back to autohinting if a TTF/OTF doesn't contain any bytecode.
This is Savannah patch #7471.
* src/base/ftobjs.c (FT_Load_Glyph): Implement it.
---
src/base/ftobjs.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 6b01f43..708055f 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -4,8 +4,7 @@
/* */
/* The FreeType private base classes (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */
-/* 2010 by */
+/* Copyright 1996-2011 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -561,6 +560,7 @@
FT_Library library;
FT_Bool autohint = FALSE;
FT_Module hinter;
+ TT_Face ttface = (TT_Face)face;
if ( !face || !face->size || !face->glyph )
@@ -601,7 +601,8 @@
* - Then, auto-hint if FT_LOAD_FORCE_AUTOHINT is set or if we don't
* have a native font hinter.
*
- * - Otherwise, auto-hint for LIGHT hinting mode.
+ * - Otherwise, auto-hint for LIGHT hinting mode or if there isn't
+ * any hinting bytecode in the TrueType/OpenType font.
*
* - Exception: The font is `tricky' and requires the native hinter to
* load properly.
@@ -626,8 +627,10 @@
FT_Render_Mode mode = FT_LOAD_TARGET_MODE( load_flags );
- if ( mode == FT_RENDER_MODE_LIGHT ||
- face->internal->ignore_unpatented_hinter )
+ if ( mode == FT_RENDER_MODE_LIGHT ||
+ face->internal->ignore_unpatented_hinter ||
+ ( FT_IS_SFNT( face ) &&
+ ttface->max_profile.maxSizeOfInstructions == 0 ) )
autohint = TRUE;
}
}
@@ -1869,7 +1872,7 @@
" is already checked and"
" no font is found\n", i ));
continue;
- }
+ }
if ( errors[i] )
{
@@ -4151,7 +4154,7 @@
FT_Renderer renderer = FT_RENDERER( module );
- if ( renderer->clazz->glyph_format == FT_GLYPH_FORMAT_OUTLINE &&
+ if ( renderer->clazz->glyph_format == FT_GLYPH_FORMAT_OUTLINE &&
renderer->raster )
renderer->clazz->raster_class->raster_done( renderer->raster );
}
--
1.7.4

View File

@ -1,11 +0,0 @@
--- freetype-2.1.10/include/freetype/config/ftoption.h.enable-ft2-bci 2005-10-12 13:50:40.000000000 -0400
+++ freetype-2.1.10/include/freetype/config/ftoption.h 2005-10-12 14:18:50.000000000 -0400
@@ -436,7 +436,7 @@
/* Do not #undef this macro here, since the build system might */
/* define it for certain configurations only. */
/* */
-/* #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
+#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER
/*************************************************************************/

View File

@ -7,7 +7,7 @@
Summary: A free and portable font rendering engine
Name: freetype
Version: 2.4.4
Release: 2%{?dist}
Release: 3%{?dist}
License: FTL or GPLv2+
Group: System Environment/Libraries
URL: http://www.freetype.org
@ -15,7 +15,6 @@ Source: http://download.savannah.gnu.org/releases/freetype/freetype-%{version}.
Source1: http://download.savannah.gnu.org/releases/freetype/freetype-doc-%{version}.tar.bz2
Source2: http://download.savannah.gnu.org/releases/freetype/ft2demos-%{version}.tar.bz2
Patch20: freetype-2.1.10-enable-ft2-bci.patch
Patch21: freetype-2.3.0-enable-spr.patch
# Enable otvalid and gxvalid modules
@ -28,13 +27,13 @@ Patch88: freetype-multilib.patch
Patch89: freetype-2.4.2-CVE-2010-3311.patch
Patch90: 0001-Fall-back-to-autohinting-if-a-TTF-OTF-doesn-t-contai.patch
Buildroot: %{_tmppath}/%{name}-%{version}-root-%(%{__id_u} -n)
BuildRequires: libX11-devel
%if %{?_with_bytecode_interpreter:1}%{!?_with_bytecode_interpreter:0}
Provides: %{name}-bytecode
%endif
%if %{?_with_subpixel_rendering:1}%{!?_with_subpixel_rendering:0}
Provides: %{name}-subpixel
%endif
@ -78,10 +77,6 @@ FreeType.
%prep
%setup -q -b 1 -a 2
%if %{?_with_bytecode_interpreter:0}%{!?_with_bytecode_interpreter:1}
%patch20 -p1 -R -b .enable-ft2-bci
%endif
%if %{?_with_subpixel_rendering:1}%{!?_with_subpixel_rendering:0}
%patch21 -p1 -b .enable-spr
%endif
@ -94,6 +89,7 @@ popd
%patch88 -p1 -b .multilib
%patch89 -p1 -b .CVE-2010-3311
%patch90 -p1 -b .auto-autohint
%build
@ -226,6 +222,10 @@ rm -rf $RPM_BUILD_ROOT
%doc docs/tutorial
%changelog
* Sun Feb 20 2011 Marek Kasik <mkasik@redhat.com> 2.4.4-3
- Enable bytecode interpreter (#547532).
- Fall back to autohinting if a TTF/OTF doesn't contain any bytecode.
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild