Skip to content

Commit a2d2f3a

Browse files
jungshikandi34
authored andcommitted
Update FreeType to 2.6.2+update from 2.4.12
1. Update to a512b0fe7a (several patches past 2.6.2). Major changes include - stem-darkening is OFF for CFF fonts by default (not relevant to klp) - general code tightening 2. A bit more details are added to README.android for the reference. The size change (libft2.so) : 49,156 bytes (from 328,944 to 378,100) master CL (https://android-review.googlesource.com/#/c/196504/) is ported BUG=24296662 Change-Id: I159f2df689808d77d79f0e4b9ccd6be6e97db08d Signed-off-by: Jungshik Shin <jungshik@google.com> (cherry picked from commit 42a68689140022fd8c067ff75fc5d573fe8f02d0)
1 parent 899c67b commit a2d2f3a

File tree

331 files changed

+28543
-13228
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

331 files changed

+28543
-13228
lines changed

Android.mk

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# this is now the default FreeType build for Android
22
#
33
ifndef USE_FREETYPE
4-
USE_FREETYPE := 2.4.2
4+
USE_FREETYPE := 2.6.2
55
endif
66

7-
ifeq ($(USE_FREETYPE),2.4.2)
7+
ifeq ($(USE_FREETYPE),2.6.2)
88
LOCAL_PATH:= $(call my-dir)
99
include $(CLEAR_VARS)
1010

@@ -14,32 +14,33 @@ include $(CLEAR_VARS)
1414
LOCAL_ARM_MODE := arm
1515

1616
LOCAL_SRC_FILES:= \
17-
src/base/ftbbox.c \
18-
src/base/ftbitmap.c \
19-
src/base/ftfstype.c \
20-
src/base/ftglyph.c \
21-
src/base/ftlcdfil.c \
22-
src/base/ftstroke.c \
23-
src/base/fttype1.c \
24-
src/base/ftxf86.c \
25-
src/base/ftbase.c \
26-
src/base/ftsystem.c \
27-
src/base/ftinit.c \
28-
src/base/ftgasp.c \
29-
src/raster/raster.c \
30-
src/sfnt/sfnt.c \
31-
src/smooth/smooth.c \
32-
src/autofit/autofit.c \
33-
src/truetype/truetype.c \
34-
src/cff/cff.c \
35-
src/psnames/psnames.c \
36-
src/pshinter/pshinter.c
17+
src/base/ftbbox.c \
18+
src/base/ftbitmap.c \
19+
src/base/ftfntfmt.c \
20+
src/base/ftfstype.c \
21+
src/base/ftglyph.c \
22+
src/base/ftlcdfil.c \
23+
src/base/ftstroke.c \
24+
src/base/fttype1.c \
25+
src/base/ftbase.c \
26+
src/base/ftsystem.c \
27+
src/base/ftinit.c \
28+
src/base/ftgasp.c \
29+
src/base/ftmm.c \
30+
src/gzip/ftgzip.c \
31+
src/raster/raster.c \
32+
src/sfnt/sfnt.c \
33+
src/smooth/smooth.c \
34+
src/autofit/autofit.c \
35+
src/truetype/truetype.c \
36+
src/cff/cff.c \
37+
src/psnames/psnames.c \
38+
src/pshinter/pshinter.c
3739

3840
LOCAL_C_INCLUDES += \
39-
$(LOCAL_PATH)/builds \
40-
$(LOCAL_PATH)/include \
41-
external/libpng \
42-
external/zlib
41+
$(LOCAL_PATH)/include \
42+
external/libpng \
43+
external/zlib
4344

4445
LOCAL_CFLAGS += -W -Wall
4546
LOCAL_CFLAGS += -fPIC -DPIC

CleanSpec.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,5 @@
4747
# ************************************************
4848
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
4949
# ************************************************
50+
51+
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libft2_*)

README.android

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Name: FreeType
2+
Version: 2.6.2 + update
3+
Revision: a512b0fe7a8d9db0e5aa9c0a4db1e92cb861722d
4+
5+
Local modifications:
6+
7+
1. Drop unused build files (Jamfiles, {module,rules}.mk)
8+
2. Drop src directories for unused modules:
9+
bdf, cid, pcf, pfr, type1, type42, winfonts
10+
3. Drop src/{bzip2,tools,lzw,otvalid,gxvalid}
11+
4. Customize include/freetype/config/{ftmodule,ftoption}.h by applying
12+
module_option.diff
13+
14+
To faciliate an easier update, all the files in src/{base,autofit} are kept
15+
even if some of them are for dropped modules/options. Android.mk can be used
16+
to control exactly what's built.

include/freetype/config/ftconfig.h

Lines changed: 35 additions & 166 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/* */
55
/* ANSI-specific configuration file (specification only). */
66
/* */
7-
/* Copyright 1996-2004, 2006-2008, 2010-2011, 2013 by */
7+
/* Copyright 1996-2015 by */
88
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
99
/* */
1010
/* This file is part of the FreeType project, and may only be used, */
@@ -27,11 +27,11 @@
2727
/* Note however that if some specific modifications are needed, we */
2828
/* advise you to place a modified copy in your build directory. */
2929
/* */
30-
/* The build directory is usually `freetype/builds/<system>', and */
31-
/* contains system-specific files that are always included first when */
32-
/* building the library. */
30+
/* The build directory is usually `builds/<system>', and contains */
31+
/* system-specific files that are always included first when building */
32+
/* the library. */
3333
/* */
34-
/* This ANSI version should stay in `include/freetype/config'. */
34+
/* This ANSI version should stay in `include/config/'. */
3535
/* */
3636
/*************************************************************************/
3737

@@ -53,7 +53,7 @@ FT_BEGIN_HEADER
5353
/* These macros can be toggled to suit a specific system. The current */
5454
/* ones are defaults used to compile FreeType in an ANSI C environment */
5555
/* (16bit compilers are also supported). Copy this file to your own */
56-
/* `freetype/builds/<system>' directory, and edit it to port the engine. */
56+
/* `builds/<system>' directory, and edit it to port the engine. */
5757
/* */
5858
/*************************************************************************/
5959

@@ -266,7 +266,16 @@ FT_BEGIN_HEADER
266266
#define FT_INT64 long
267267
#define FT_UINT64 unsigned long
268268

269-
#elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */
269+
/*************************************************************************/
270+
/* */
271+
/* A 64-bit data type may create compilation problems if you compile */
272+
/* in strict ANSI mode. To avoid them, we disable other 64-bit data */
273+
/* types if __STDC__ is defined. You can however ignore this rule */
274+
/* by defining the FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */
275+
/* */
276+
#elif !defined( __STDC__ ) || defined( FT_CONFIG_OPTION_FORCE_INT64 )
277+
278+
#if defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */
270279

271280
/* this compiler provides the __int64 type */
272281
#define FT_LONG64
@@ -300,178 +309,35 @@ FT_BEGIN_HEADER
300309
#define FT_INT64 long long int
301310
#define FT_UINT64 unsigned long long int
302311

303-
#endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */
304-
305-
306-
/*************************************************************************/
307-
/* */
308-
/* A 64-bit data type will create compilation problems if you compile */
309-
/* in strict ANSI mode. To avoid them, we disable its use if __STDC__ */
310-
/* is defined. You can however ignore this rule by defining the */
311-
/* FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */
312-
/* */
313-
#if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 )
314-
315-
#ifdef __STDC__
316-
317-
/* undefine the 64-bit macros in strict ANSI compilation mode */
318-
#undef FT_LONG64
319-
#undef FT_INT64
320-
321-
#endif /* __STDC__ */
312+
#endif /* _MSC_VER */
322313

323-
#endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */
314+
#endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */
324315

325316
#ifdef FT_LONG64
326317
typedef FT_INT64 FT_Int64;
327318
typedef FT_UINT64 FT_UInt64;
328319
#endif
329320

330321

322+
/*************************************************************************/
323+
/* */
324+
/* miscellaneous */
325+
/* */
326+
/*************************************************************************/
327+
328+
331329
#define FT_BEGIN_STMNT do {
332330
#define FT_END_STMNT } while ( 0 )
333331
#define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT
334332

335333

336-
#ifndef FT_CONFIG_OPTION_NO_ASSEMBLER
337-
/* Provide assembler fragments for performance-critical functions. */
338-
/* These must be defined `static __inline__' with GCC. */
339-
340-
#if defined( __CC_ARM ) || defined( __ARMCC__ ) /* RVCT */
341-
#define FT_MULFIX_ASSEMBLER FT_MulFix_arm
342-
343-
/* documentation is in freetype.h */
344-
345-
static __inline FT_Int32
346-
FT_MulFix_arm( FT_Int32 a,
347-
FT_Int32 b )
348-
{
349-
register FT_Int32 t, t2;
350-
351-
352-
__asm
353-
{
354-
smull t2, t, b, a /* (lo=t2,hi=t) = a*b */
355-
mov a, t, asr #31 /* a = (hi >> 31) */
356-
add a, a, #0x8000 /* a += 0x8000 */
357-
adds t2, t2, a /* t2 += a */
358-
adc t, t, #0 /* t += carry */
359-
mov a, t2, lsr #16 /* a = t2 >> 16 */
360-
orr a, a, t, lsl #16 /* a |= t << 16 */
361-
}
362-
return a;
363-
}
364-
365-
#endif /* __CC_ARM || __ARMCC__ */
366-
367-
368-
#ifdef __GNUC__
369-
370-
#if defined( __arm__ ) && !defined( __thumb__ ) && \
371-
!( defined( __CC_ARM ) || defined( __ARMCC__ ) )
372-
#define FT_MULFIX_ASSEMBLER FT_MulFix_arm
373-
374-
/* documentation is in freetype.h */
375-
376-
static __inline__ FT_Int32
377-
FT_MulFix_arm( FT_Int32 a,
378-
FT_Int32 b )
379-
{
380-
register FT_Int32 t, t2;
381-
382-
383-
__asm__ __volatile__ (
384-
"smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */
385-
"mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */
386-
"add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */
387-
"adds %1, %1, %0\n\t" /* %1 += %0 */
388-
"adc %2, %2, #0\n\t" /* %2 += carry */
389-
"mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */
390-
"orr %0, %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */
391-
: "=r"(a), "=&r"(t2), "=&r"(t)
392-
: "r"(a), "r"(b)
393-
: "cc" );
394-
return a;
395-
}
396-
397-
#endif /* __arm__ && !__thumb__ && !( __CC_ARM || __ARMCC__ ) */
398-
399-
#if defined( __i386__ )
400-
#define FT_MULFIX_ASSEMBLER FT_MulFix_i386
401-
402-
/* documentation is in freetype.h */
403-
404-
static __inline__ FT_Int32
405-
FT_MulFix_i386( FT_Int32 a,
406-
FT_Int32 b )
407-
{
408-
register FT_Int32 result;
409-
410-
411-
__asm__ __volatile__ (
412-
"imul %%edx\n"
413-
"movl %%edx, %%ecx\n"
414-
"sarl $31, %%ecx\n"
415-
"addl $0x8000, %%ecx\n"
416-
"addl %%ecx, %%eax\n"
417-
"adcl $0, %%edx\n"
418-
"shrl $16, %%eax\n"
419-
"shll $16, %%edx\n"
420-
"addl %%edx, %%eax\n"
421-
: "=a"(result), "=d"(b)
422-
: "a"(a), "d"(b)
423-
: "%ecx", "cc" );
424-
return result;
425-
}
426-
427-
#endif /* i386 */
428-
429-
#endif /* __GNUC__ */
430-
431-
432-
#ifdef _MSC_VER /* Visual C++ */
433-
434-
#ifdef _M_IX86
435-
436-
#define FT_MULFIX_ASSEMBLER FT_MulFix_i386
437-
438-
/* documentation is in freetype.h */
439-
440-
static __inline FT_Int32
441-
FT_MulFix_i386( FT_Int32 a,
442-
FT_Int32 b )
443-
{
444-
register FT_Int32 result;
445-
446-
__asm
447-
{
448-
mov eax, a
449-
mov edx, b
450-
imul edx
451-
mov ecx, edx
452-
sar ecx, 31
453-
add ecx, 8000h
454-
add eax, ecx
455-
adc edx, 0
456-
shr eax, 16
457-
shl edx, 16
458-
add eax, edx
459-
mov result, eax
460-
}
461-
return result;
462-
}
463-
464-
#endif /* _M_IX86 */
465-
466-
#endif /* _MSC_VER */
467-
468-
#endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */
469-
470-
471-
#ifdef FT_CONFIG_OPTION_INLINE_MULFIX
472-
#ifdef FT_MULFIX_ASSEMBLER
473-
#define FT_MULFIX_INLINED FT_MULFIX_ASSEMBLER
474-
#endif
334+
/* typeof condition taken from gnulib's `intprops.h' header file */
335+
#if ( __GNUC__ >= 2 || \
336+
defined( __IBM__TYPEOF__ ) || \
337+
( __SUNPRO_C >= 0x5110 && !__STDC__ ) )
338+
#define FT_TYPEOF( type ) (__typeof__ (type))
339+
#else
340+
#define FT_TYPEOF( type ) /* empty */
475341
#endif
476342

477343

@@ -492,6 +358,9 @@ FT_BEGIN_HEADER
492358

493359
#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
494360

361+
#define FT_LOCAL_ARRAY( x ) extern const x
362+
#define FT_LOCAL_ARRAY_DEF( x ) const x
363+
495364

496365
#ifndef FT_BASE
497366

include/freetype/config/ftheader.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/* */
55
/* Build macros of the FreeType 2 library. */
66
/* */
7-
/* Copyright 1996-2008, 2010, 2012, 2013 by */
7+
/* Copyright 1996-2015 by */
88
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
99
/* */
1010
/* This file is part of the FreeType project, and may only be used, */
@@ -710,14 +710,16 @@
710710
/*************************************************************************
711711
*
712712
* @macro:
713-
* FT_XFREE86_H
713+
* FT_FONT_FORMATS_H
714714
*
715715
* @description:
716716
* A macro used in #include statements to name the file containing the
717-
* FreeType~2 API which provides functions specific to the XFree86 and
718-
* X.Org X11 servers.
717+
* FreeType~2 API which provides functions specific to font formats.
719718
*/
720-
#define FT_XFREE86_H <freetype/ftxf86.h>
719+
#define FT_FONT_FORMATS_H <freetype/ftfntfmt.h>
720+
721+
/* deprecated */
722+
#define FT_XFREE86_H FT_FONT_FORMATS_H
721723

722724

723725
/*************************************************************************
@@ -817,7 +819,7 @@
817819

818820

819821
/*
820-
* Include internal headers definitions from <freetype/internal/...>
822+
* Include internal headers definitions from <internal/...>
821823
* only when building the library.
822824
*/
823825
#ifdef FT2_BUILD_LIBRARY

0 commit comments

Comments
 (0)