summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Volkov <pva@gentoo.org>2008-06-20 10:11:03 +0000
committerPeter Volkov <pva@gentoo.org>2008-06-20 10:11:03 +0000
commita983448c4defdcbc4c21a9cbe234855768f97325 (patch)
treed1906a6e3620c4b96c6190d69e471d28129ecddd /media-libs/freetype
parentChanged rb_libtorrent dependency to =0.12* (diff)
downloadgentoo-2-a983448c4defdcbc4c21a9cbe234855768f97325.tar.gz
gentoo-2-a983448c4defdcbc4c21a9cbe234855768f97325.tar.bz2
gentoo-2-a983448c4defdcbc4c21a9cbe234855768f97325.zip
Fix incorrent size of rendered fonts, bug #228095, thank Jacob for report and Werner Lemberg for the fix.
(Portage version: 2.1.4.4)
Diffstat (limited to 'media-libs/freetype')
-rw-r--r--media-libs/freetype/ChangeLog10
-rw-r--r--media-libs/freetype/files/freetype-2.3.6-incorect-font-scaling.patch252
-rw-r--r--media-libs/freetype/freetype-2.3.6-r1.ebuild118
3 files changed, 379 insertions, 1 deletions
diff --git a/media-libs/freetype/ChangeLog b/media-libs/freetype/ChangeLog
index 089d0e563467..368f7a8aa975 100644
--- a/media-libs/freetype/ChangeLog
+++ b/media-libs/freetype/ChangeLog
@@ -1,6 +1,14 @@
# ChangeLog for media-libs/freetype
# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/media-libs/freetype/ChangeLog,v 1.186 2008/06/13 15:15:53 dertobi123 Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-libs/freetype/ChangeLog,v 1.187 2008/06/20 10:11:02 pva Exp $
+
+*freetype-2.3.6-r1 (20 Jun 2008)
+
+ 20 Jun 2008; Peter Volkov <pva@gentoo.org>
+ +files/freetype-2.3.6-incorect-font-scaling.patch,
+ +freetype-2.3.6-r1.ebuild:
+ Fix incorrent size of rendered fonts, bug #228095, thank Jacob for report
+ and Werner Lemberg for the fix.
13 Jun 2008; Tobias Scherbaum <dertobi123@gentoo.org>
freetype-2.3.6.ebuild:
diff --git a/media-libs/freetype/files/freetype-2.3.6-incorect-font-scaling.patch b/media-libs/freetype/files/freetype-2.3.6-incorect-font-scaling.patch
new file mode 100644
index 000000000000..0688bbebaf90
--- /dev/null
+++ b/media-libs/freetype/files/freetype-2.3.6-incorect-font-scaling.patch
@@ -0,0 +1,252 @@
+2008-06-19 Werner Lemberg <wl@gnu.org>
+
+ * src/cff/cffobjs.c (cff_face_init): Compute final
+ `dict->units_per_em' value before assigning it to
+ `cffface->units_per_EM'. Otherwise, CFFs without subfonts are be
+ scaled incorrectly if the font matrix is non-standard. This fixes
+ Savannah bug #23630.
+
+Index: src/cff/cffobjs.c
+===================================================================
+RCS file: /sources/freetype/freetype2/src/cff/cffobjs.c,v
+retrieving revision 1.89
+retrieving revision 1.90
+diff -u -B -r1.89 -r1.90
+--- src/cff/cffobjs.c 14 May 2008 23:05:37 -0000 1.89
++++ src/cff/cffobjs.c 19 Jun 2008 16:23:43 -0000 1.90
+@@ -534,6 +534,111 @@
+ goto Bad_Format;
+ }
+
++ if ( !dict->units_per_em )
++ dict->units_per_em = pure_cff ? 1000 : face->root.units_per_EM;
++
++ /* Normalize the font matrix so that `matrix->xx' is 1; the */
++ /* scaling is done with `units_per_em' then (at this point, */
++ /* it already contains the scaling factor, but without */
++ /* normalization of the matrix). */
++ /* */
++ /* Note that the offsets must be expressed in integer font */
++ /* units. */
++
++ {
++ FT_Matrix* matrix = &dict->font_matrix;
++ FT_Vector* offset = &dict->font_offset;
++ FT_ULong* upm = &dict->units_per_em;
++ FT_Fixed temp = FT_ABS( matrix->yy );
++
++
++ if ( temp != 0x10000L )
++ {
++ *upm = FT_DivFix( *upm, temp );
++
++ matrix->xx = FT_DivFix( matrix->xx, temp );
++ matrix->yx = FT_DivFix( matrix->yx, temp );
++ matrix->xy = FT_DivFix( matrix->xy, temp );
++ matrix->yy = FT_DivFix( matrix->yy, temp );
++ offset->x = FT_DivFix( offset->x, temp );
++ offset->y = FT_DivFix( offset->y, temp );
++ }
++
++ offset->x >>= 16;
++ offset->y >>= 16;
++ }
++
++ for ( i = cff->num_subfonts; i > 0; i-- )
++ {
++ CFF_FontRecDict sub = &cff->subfonts[i - 1]->font_dict;
++ CFF_FontRecDict top = &cff->top_font.font_dict;
++
++ FT_Matrix* matrix;
++ FT_Vector* offset;
++ FT_ULong* upm;
++ FT_Fixed temp;
++
++
++ if ( sub->units_per_em )
++ {
++ FT_Int scaling;
++
++
++ if ( top->units_per_em > 1 && sub->units_per_em > 1 )
++ scaling = FT_MIN( top->units_per_em, sub->units_per_em );
++ else
++ scaling = 1;
++
++ FT_Matrix_Multiply_Scaled( &top->font_matrix,
++ &sub->font_matrix,
++ scaling );
++ FT_Vector_Transform_Scaled( &sub->font_offset,
++ &top->font_matrix,
++ scaling );
++
++ sub->units_per_em = FT_MulDiv( sub->units_per_em,
++ top->units_per_em,
++ scaling );
++ }
++ else
++ {
++ sub->font_matrix = top->font_matrix;
++ sub->font_offset = top->font_offset;
++
++ sub->units_per_em = top->units_per_em;
++ }
++
++ matrix = &sub->font_matrix;
++ offset = &sub->font_offset;
++ upm = &sub->units_per_em;
++ temp = FT_ABS( matrix->yy );
++
++ if ( temp != 0x10000L )
++ {
++ *upm = FT_DivFix( *upm, temp );
++
++ /* if *upm is larger than 100*1000 we divide by 1000 -- */
++ /* this can happen if e.g. there is no top-font FontMatrix */
++ /* and the subfont FontMatrix already contains the complete */
++ /* scaling for the subfont (see section 5.11 of the PLRM) */
++
++ /* 100 is a heuristic value */
++
++ if ( *upm > 100L * 1000L )
++ *upm = ( *upm + 500 ) / 1000;
++
++ matrix->xx = FT_DivFix( matrix->xx, temp );
++ matrix->yx = FT_DivFix( matrix->yx, temp );
++ matrix->xy = FT_DivFix( matrix->xy, temp );
++ matrix->yy = FT_DivFix( matrix->yy, temp );
++ offset->x = FT_DivFix( offset->x, temp );
++ offset->y = FT_DivFix( offset->y, temp );
++ }
++
++ offset->x >>= 16;
++ offset->y >>= 16;
++ }
++
+ if ( pure_cff )
+ {
+ char* style_name = NULL;
+@@ -554,8 +659,6 @@
+ cffface->bbox.xMax = ( dict->font_bbox.xMax + 0xFFFFU ) >> 16;
+ cffface->bbox.yMax = ( dict->font_bbox.yMax + 0xFFFFU ) >> 16;
+
+- if ( !dict->units_per_em )
+- dict->units_per_em = 1000;
+
+ cffface->units_per_EM = dict->units_per_em;
+
+@@ -711,114 +814,8 @@
+
+ cffface->style_flags = flags;
+ }
+- else
+- {
+- if ( !dict->units_per_em )
+- dict->units_per_em = face->root.units_per_EM;
+- }
+-
+- /* Normalize the font matrix so that `matrix->xx' is 1; the */
+- /* scaling is done with `units_per_em' then (at this point, */
+- /* it already contains the scaling factor, but without */
+- /* normalization of the matrix). */
+- /* */
+- /* Note that the offsets must be expressed in integer font */
+- /* units. */
+-
+- {
+- FT_Matrix* matrix = &dict->font_matrix;
+- FT_Vector* offset = &dict->font_offset;
+- FT_ULong* upm = &dict->units_per_em;
+- FT_Fixed temp = FT_ABS( matrix->yy );
+-
+-
+- if ( temp != 0x10000L )
+- {
+- *upm = FT_DivFix( *upm, temp );
+-
+- matrix->xx = FT_DivFix( matrix->xx, temp );
+- matrix->yx = FT_DivFix( matrix->yx, temp );
+- matrix->xy = FT_DivFix( matrix->xy, temp );
+- matrix->yy = FT_DivFix( matrix->yy, temp );
+- offset->x = FT_DivFix( offset->x, temp );
+- offset->y = FT_DivFix( offset->y, temp );
+- }
+-
+- offset->x >>= 16;
+- offset->y >>= 16;
+- }
+-
+- for ( i = cff->num_subfonts; i > 0; i-- )
+- {
+- CFF_FontRecDict sub = &cff->subfonts[i - 1]->font_dict;
+- CFF_FontRecDict top = &cff->top_font.font_dict;
+-
+- FT_Matrix* matrix;
+- FT_Vector* offset;
+- FT_ULong* upm;
+- FT_Fixed temp;
+
+
+- if ( sub->units_per_em )
+- {
+- FT_Int scaling;
+-
+-
+- if ( top->units_per_em > 1 && sub->units_per_em > 1 )
+- scaling = FT_MIN( top->units_per_em, sub->units_per_em );
+- else
+- scaling = 1;
+-
+- FT_Matrix_Multiply_Scaled( &top->font_matrix,
+- &sub->font_matrix,
+- scaling );
+- FT_Vector_Transform_Scaled( &sub->font_offset,
+- &top->font_matrix,
+- scaling );
+-
+- sub->units_per_em = FT_MulDiv( sub->units_per_em,
+- top->units_per_em,
+- scaling );
+- }
+- else
+- {
+- sub->font_matrix = top->font_matrix;
+- sub->font_offset = top->font_offset;
+-
+- sub->units_per_em = top->units_per_em;
+- }
+-
+- matrix = &sub->font_matrix;
+- offset = &sub->font_offset;
+- upm = &sub->units_per_em;
+- temp = FT_ABS( matrix->yy );
+-
+- if ( temp != 0x10000L )
+- {
+- *upm = FT_DivFix( *upm, temp );
+-
+- /* if *upm is larger than 100*1000 we divide by 1000 -- */
+- /* this can happen if e.g. there is no top-font FontMatrix */
+- /* and the subfont FontMatrix already contains the complete */
+- /* scaling for the subfont (see section 5.11 of the PLRM) */
+-
+- /* 100 is a heuristic value */
+-
+- if ( *upm > 100L * 1000L )
+- *upm = ( *upm + 500 ) / 1000;
+-
+- matrix->xx = FT_DivFix( matrix->xx, temp );
+- matrix->yx = FT_DivFix( matrix->yx, temp );
+- matrix->xy = FT_DivFix( matrix->xy, temp );
+- matrix->yy = FT_DivFix( matrix->yy, temp );
+- offset->x = FT_DivFix( offset->x, temp );
+- offset->y = FT_DivFix( offset->y, temp );
+- }
+-
+- offset->x >>= 16;
+- offset->y >>= 16;
+- }
+-
+ #ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
+ /* CID-keyed CFF fonts don't have glyph names -- the SFNT loader */
+ /* has unset this flag because of the 3.0 `post' table. */
diff --git a/media-libs/freetype/freetype-2.3.6-r1.ebuild b/media-libs/freetype/freetype-2.3.6-r1.ebuild
new file mode 100644
index 000000000000..a1a1b57b90fd
--- /dev/null
+++ b/media-libs/freetype/freetype-2.3.6-r1.ebuild
@@ -0,0 +1,118 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-libs/freetype/freetype-2.3.6-r1.ebuild,v 1.1 2008/06/20 10:11:02 pva Exp $
+
+inherit eutils flag-o-matic libtool
+
+DESCRIPTION="A high-quality and portable font engine"
+HOMEPAGE="http://www.freetype.org/"
+SRC_URI="mirror://sourceforge/freetype/${P/_/}.tar.bz2
+ utils? ( mirror://sourceforge/freetype/ft2demos-${PV}.tar.bz2 )
+ doc? ( mirror://sourceforge/freetype/${PN}-doc-${PV}.tar.bz2 )"
+
+LICENSE="FTL GPL-2"
+SLOT="2"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd"
+IUSE="X bindist debug doc utils"
+
+DEPEND="X? ( x11-libs/libX11
+ x11-libs/libXau
+ x11-libs/libXdmcp )"
+
+# We also need a recent fontconfig version to prevent segfaults. #166029
+# July 3 2007 dirtyepic
+RDEPEND="${DEPEND}
+ !<media-libs/fontconfig-2.3.2-r2"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ enable_option() {
+ sed -i -e "/#define $1/a #define $1" \
+ include/freetype/config/ftoption.h \
+ || die "unable to enable option $1"
+ }
+
+ disable_option() {
+ sed -i -e "/#define $1/ { s:^:/*:; s:$:*/: }" \
+ include/freetype/config/ftoption.h \
+ || die "unable to disable option $1"
+ }
+
+ if ! use bindist; then
+ # Bytecodes and subpixel hinting supports are patented
+ # in United States; for safety, disable them while building
+ # binaries, so that no risky code is distributed.
+ # See http://freetype.org/patents.html
+
+ enable_option FT_CONFIG_OPTION_SUBPIXEL_RENDERING
+ enable_option TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+ disable_option TT_CONFIG_OPTION_UNPATENTED_HINTING
+ fi
+
+ if use debug; then
+ enable_option FT_DEBUG_LEVEL_ERROR
+ enable_option FT_DEBUG_MEMORY
+ fi
+
+ enable_option FT_CONFIG_OPTION_INCREMENTAL
+ disable_option FT_CONFIG_OPTION_OLD_INTERNALS
+
+ epatch "${FILESDIR}"/${PN}-2.3.2-enable-valid.patch
+ epatch "${FILESDIR}"/${P}-incorect-font-scaling.patch
+
+ if use utils; then
+ cd "${WORKDIR}"/ft2demos-${PV}
+ sed -i -e "s:\.\.\/freetype2$:../freetype-${PV}:" Makefile
+
+ # Disable tests needing X11 when USE="-X". (bug #177597)
+ if ! use X; then
+ sed -i -e "/EXES\ +=\ ftview/ s:^:#:" Makefile
+ fi
+ fi
+
+ elibtoolize
+ epunt_cxx
+}
+
+src_compile() {
+ append-flags -fno-strict-aliasing
+
+ type -P gmake &> /dev/null && export GNUMAKE=gmake
+ econf || die "econf failed"
+ emake || die "emake failed"
+
+ if use utils; then
+ cd "${WORKDIR}"/ft2demos-${PV}
+ emake || die "ft2demos emake failed"
+ fi
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "emake install failed"
+
+ dodoc ChangeLog README
+ dodoc docs/{CHANGES,CUSTOMIZE,DEBUG,*.txt,PATENTS,TODO}
+
+ use doc && dohtml -r docs/*
+
+ if use utils; then
+ rm "${WORKDIR}"/ft2demos-${PV}/bin/README
+ for ft2demo in ../ft2demos-${PV}/bin/*; do
+ ./builds/unix/libtool --mode=install $(type -P install) -m 755 "$ft2demo" \
+ "${D}"/usr/bin
+ done
+ fi
+}
+
+pkg_postinst() {
+ echo
+ ewarn "After upgrading to freetype-2.3.5, it is necessary to rebuild"
+ ewarn "libXfont to avoid build errors in some packages."
+ echo
+ elog "The utilities and demos previously bundled with freetype are now"
+ elog "optional. Enable the utils USE flag if you would like them"
+ elog "to be installed."
+ echo
+}