Re: [ft-devel] Correct way to calculate line gap/external leading

2011-04-12 Thread Jjgod Jiang
On Wed, Apr 13, 2011 at 6:21 AM, Collyer, Oliver, SI
 wrote:
>>> 64 looks wrong... surely /64 or >>6 assuming those are in 26.6.

Oh, that's a typo, I used >> 6 in the actual code.

- Jiang

___
Freetype-devel mailing list
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel


[ft-devel] Correct way to calculate line gap/external leading

2011-04-12 Thread Jjgod Jiang
Hi,

I can't find in FreeType's docs on how to calculate the line gap,
currently we are using:

FT_Size_Metrics metrics = face->size->metrics;
leading = (metrics.height - metrics.ascender + metrics.descender) >> 64;

but sometimes I get -1 as the leading (Lucida Grande from Mac OS X, Ubuntu
fonts, Inconsolata, DejaVu Sans). Is it fine to have negative leading? or
is there anything wrong with my code? Thanks.

Attached my code to test.

- Jiang
#include 
#include FT_FREETYPE_H

int main(int argc, char *argv[])
{
FT_Library library;
FT_Face face;
FT_Init_FreeType(&library);
FT_New_Face(library, argv[1], 0, &face);
FT_Set_Char_Size(face, 0, 12 * 64, 72, 72);
FT_Size_Metrics metrics = face->size->metrics;

printf("%ld, %ld - %ld + %ld\n", 
(metrics.height - metrics.ascender + metrics.descender) >> 6, 
metrics.height >> 6, metrics.ascender >> 6, metrics.descender >> 6);
return 0;
}
___
Freetype-devel mailing list
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel


[ft-devel] Re: [tex-live] Fw: "CMap Resources" open source project

2009-09-22 Thread Jjgod Jiang
Hi,

On Wed, Sep 23, 2009 at 12:43 AM, Werner LEMBERG  wrote:
>
> I've just received this letter from Ken; you might be interesting in
> reading it.
>
>
>     Werner
>
>
> -- Forwarded message --
> From: Ken Lunde 
> To: Werner LEMBERG 
> Date: Tue, 22 Sep 2009 07:24:37 -0700
> Subject: "CMap Resources" open source project
> Werner,
>
> I would like to let you know that we just launched the "CMap Resources" open 
> source project at Adobe, which puts all of our CMap resources under a more 
> favorable open source license. Note that I excluded the Adobe-Japan2-0 CMap 
> resources, because they have been in deprecated status ever since 
> Adobe-Japan1-6 was released to completely cover JIS X 0212-1990.
>
> Anyway, you can get the details here:
>
>  http://opensource.adobe.com/wiki/display/cmap/

Just curious, it does not seemed to contain "Unicode Mapping files"
like GBK-EUC-UCS2, Adobe-GB1-UCS2, GBpc-EUC-UCS2, etc. Are they dropped?
Because it is useful for dvipdfmx to generate correct bookmarks if the
source encoding is not Unicode.

- Jiang


___
Freetype-devel mailing list
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel


[ft-devel] Points in FT_Outline

2007-12-11 Thread Jjgod Jiang
Hi,

I'm trying to fetch all the points from FT_Outline of a glyph, here is
a minimal example,

/* testft.c: test FreeType capabilities */

#include 
#include 
#include 
#include 
#include FT_FREETYPE_H
#include FT_OUTLINE_H

#define DOUBLE_TO_16_16(d) ((FT_Fixed)((d) * 65536.0))
#define DOUBLE_FROM_26_6(t) ((double)(t) / 64.0)

int move_to(const FT_Vector *to, void *user);
int line_to(const FT_Vector *to, void *user);
int conic_to(const FT_Vector *control, const FT_Vector *to, void *user);
int cubic_to(const FT_Vector *control1, const FT_Vector *control2,
 const FT_Vector *to, void *user);

int main(int argc, char *argv[])
{
FT_Errorerror;
FT_Library  library;
FT_Face face;
FT_UInt glyph_index;
FT_Outline *outline;
FT_ULongcharcode = 'Z';

error = FT_Init_FreeType(&library);
assert(error == 0);

error = FT_New_Face(library, argv[1], 0, &face);
assert(error == 0);

glyph_index = FT_Get_Char_Index(face, charcode);
assert(glyph_index != 0);

error = FT_Load_Glyph(face, glyph_index,
  FT_LOAD_DEFAULT);
assert(error == 0);

assert(face->glyph->format == FT_GLYPH_FORMAT_OUTLINE);

outline = &face->glyph->outline;
printf("n_contours = %d\n", outline->n_contours);
printf("n_points   = %d\n", outline->n_points);

FT_Outline_Funcs outline_funcs = { move_to, line_to, conic_to,
cubic_to, 0, 0 };
FT_Outline_Decompose(outline, &outline_funcs, NULL);

FT_Done_Face(face);
FT_Done_FreeType(library);

return 0;
}

void print4bytes(const char *bytes)
{
int i;

for (i = 0; i < 4; i++)
printf("%02X ", bytes[i]);

printf("\n");
}

int move_to(const FT_Vector *to, void *user)
{
print4bytes((char *) &(to->x));
print4bytes((char *) &(to->y));

printf("move_to([%g, %g])\n",
DOUBLE_FROM_26_6(to->x), DOUBLE_FROM_26_6(to->y));

return 0;
}

int line_to(const FT_Vector *to, void *user)
{
printf("line_to([%g, %g])\n",
   DOUBLE_FROM_26_6(to->x), DOUBLE_FROM_26_6(to->y));

return 0;
}

int conic_to(const FT_Vector *control, const FT_Vector *to, void *user)
{
printf("conic_to(c = [%g, %g], to = [%g, %g])\n",
   DOUBLE_FROM_26_6(control->x), DOUBLE_FROM_26_6(control->y),
   DOUBLE_FROM_26_6(to->x), DOUBLE_FROM_26_6(to->y));

return 0;
}

int cubic_to(const FT_Vector *control1, const FT_Vector *control2,
 const FT_Vector *to, void *user)
{
printf("cubic_to(c1 = [%g, %g], c2 = [%g, %g], to = [%g, %g])\n",
   DOUBLE_FROM_26_6(control1->x), DOUBLE_FROM_26_6(control1->y),
   DOUBLE_FROM_26_6(control2->x), DOUBLE_FROM_26_6(control2->y),
   DOUBLE_FROM_26_6(to->x), DOUBLE_FROM_26_6(to->y));
return 0;
}

The n_points and n_contours printed is correct, but the point FT_Vector
does not contain any useful values, for example:

$ ./testft /Library/Fonts/Arial.ttf
n_contours = 1
n_points   = 13
00 00 00 00
04 00 00 00
move_to([0, 0.0625])
line_to([0, 0.0625])
line_to([0, 0.0625])
conic_to(c = [0, 0.0625], to = [0, 0.0625])
line_to([0, 0.0625])
line_to([0, 0.0625])
line_to([0, 0.0625])
line_to([0, 0.0625])
line_to([0, 0.0625])
line_to([0, 0.0625])
line_to([0, 0.0625])
line_to([0, 0.0625])
line_to([0, 0.0625])

I'm wondering what's wrong with my code. Thanks!

- Jiang


___
Freetype-devel mailing list
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel


Re: [ft-devel] Minor misc patches to freetype cvs, from custom changes in vtk

2007-03-24 Thread Jjgod Jiang

Hi,

2007/3/23, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:

Excuse me, please let me alter the phraseology:
Mac OS X 10.4.x on Intel Mac can execute 64bit Intel Mac binary?


Yes, I can confirm that, Intel Core 2 Duo (now all upgraded MacBook Pro,
MacBook and iMac using) is 64-bit CPU. Xcode Tools support generating
x86_64 binaries since version 2.4.

- jjgod.


___
Freetype-devel mailing list
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel


[ft-devel] Fix a minor memory leak in ftmac.c

2007-02-18 Thread Jjgod Jiang

Hi,

The patch attached fixed a minor memory leak in ftmac.c,
just CFStringRef created without release.

- jjgod.


fix-ftmac-minor-mem-leak.patch
Description: Binary data
___
Freetype-devel mailing list
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel


Fwd: [ft-devel] ftview/ftstring segfault with -e unic

2006-05-13 Thread Jjgod Jiang

-- Forwarded message --
From: Jjgod Jiang <[EMAIL PROTECTED]>
Date: 2006-5-14 上午5:27
Subject: Re: [ft-devel] ftview/ftstring segfault with -e unic
To: Werner LEMBERG <[EMAIL PROTECTED]>


Hi,

# gcc --ver
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.0.3/configure --host=i686-pc-linux-gnu
--build=i686-pc-linux-gnu --prefix=/usr --enable-shared
--enable-languages=c,c++,objc --enable-threads=posix
--enable-__cxa_atexit
Thread model: posix
gcc version 4.0.3

CC = gcc
CFLAGS = -c -Wall -g -DFT_CONFIG_OPTION_SYSTEM_ZLIB
-DFT_CONFIG_CONFIG_H=""

here is the compelete commands used to build ftview:

gcc -c -Wall -g -DFT_CONFIG_OPTION_SYSTEM_ZLIB
-DFT_CONFIG_CONFIG_H="" -I../freetype2/builds/unix
-I../freetype2/builds/unix -I/root/src/freetype/freetype2/include
-I/root/src/freetype/ft2demos-2.2.1/src
-DFT_CONFIG_MODULES_H=""
-I/root/src/freetype/ft2demos-2.2.1/graph \
-o /root/src/freetype/ft2demos-2.2.1/obj/ftview.o
/root/src/freetype/ft2demos-2.2.1/src/ftview.c -DFT2_BUILD_LIBRARY
gcc -c -Wall -g -DFT_CONFIG_OPTION_SYSTEM_ZLIB
-DFT_CONFIG_CONFIG_H="" -I../freetype2/builds/unix
-I../freetype2/builds/unix -I/root/src/freetype/freetype2/include
-I/root/src/freetype/ft2demos-2.2.1/src
-DFT_CONFIG_MODULES_H=""
-I/root/src/freetype/ft2demos-2.2.1/graph \
-o
/root/src/freetype/ft2demos-2.2.1/obj/ftcommon.o
/root/src/freetype/ft2demos-2.2.1/src/ftcommon.c
../freetype2/builds/unix/libtool --mode=link gcc -lz -o
/root/src/freetype/ft2demos-2.2.1/bin/ftview
/root/src/freetype/ft2demos-2.2.1/obj/ftview.o
/root/src/freetype/ft2demos-2.2.1/obj/common.o
/root/src/freetype/ft2demos-2.2.1/obj/ftcommon.o
/root/src/freetype/freetype2/objs/libfreetype.la
/root/src/freetype/ft2demos-2.2.1/obj/graph.a -R/usr/X11R6/lib
-L/usr/X11R6/lib -lX11 -lm
gcc -o /root/src/freetype/ft2demos-2.2.1/bin/.libs/ftview
/root/src/freetype/ft2demos-2.2.1/obj/ftview.o
/root/src/freetype/ft2demos-2.2.1/obj/common.o
/root/src/freetype/ft2demos-2.2.1/obj/ftcommon.o
/root/src/freetype/freetype2/objs/.libs/libfreetype.so -lz
/root/src/freetype/ft2demos-2.2.1/obj/graph.a -L/usr/X11R6/lib -lX11
-lm -Wl,--rpath -Wl,/root/src/freetype/release/lib -Wl,--rpath
-Wl,/usr/X11R6/lib
c

here is my backtrace log:
(gdb) run -e unic -f 25000 ppem KozMinProVI-Regular.otf

Program received signal SIGSEGV, Segmentation fault.
FT_Stream_ReadLong (stream=0x80bca68, error=0xbfcc4fc8) at ftstream.c:635
/root/src/freetype/freetype-2.2.1/src/base/ftstream.c:635:14617:beg:0xb7f53e1c
(gdb) bt
#0  FT_Stream_ReadLong (stream=0x80bca68, error=0xbfcc4fc8) at ftstream.c:635
#1  0xb7f83805 in sfnt_init_face (stream=0x80bca68, face=0x80bca98,
face_index=1917873769, num_params=0, params=0x0) at sfobjs.c:377
#2  0xb7f61542 in tt_face_init (stream=0x80bca68, ttface=0x80bca98,
face_index=1917873769, num_params=0, params=0x0) at ttobjs.c:191
#3  0xb7f5721a in open_face (driver=0x8066970, stream=0x80bca68,
face_index=1917873769, num_params=0, params=0x0, aface=0xbfcc5204) at
ftobjs.c:987
#4  0xb7f57c11 in FT_Open_Face (library=0x80628a0, args=0xbfcc5244,
face_index=1917873769, aface=0x80bca5c) at ftobjs.c:1694
#5  0xb7f5885e in FT_New_Memory_Face (library=0x0, file_base=0x0,
file_size=0, face_index=0, aface=0x0) at ftobjs.c:1073
#6  0x0804bab1 in my_face_requester (face_id=0x81073f0, lib=0x0,
request_data=0x0, aface=0x80bca5c) at
/root/src/freetype/ft2demos-2.2.1/src/ftcommon.c:204
#7  0xb7f95426 in ftc_face_node_init (ftcnode=0x80bca50,
ftcface_id=0x0, ftcmanager=0x0) at ftcmanag.c:237
#8  0xb7f94f26 in FTC_MruList_New (list=0x8068a4c, key=0x81073f0,
anode=0xbfcc533c) at ftcmru.c:269
#9  0xb7f9506a in FTC_Manager_LookupFace (manager=0x80689f0,
face_id=0x81073f0, aface=0xbfcc5380) at ftcmanag.c:319
#10 0xb7f96421 in FTC_CMapCache_Lookup (cmap_cache=0x8068c18,
face_id=0x80c8658, cmap_index=4, char_code=4) at ftccmap.c:381
#11 0x0804c46c in FTDemo_Get_Index (handle=0x0, charcode=0) at
/root/src/freetype/ft2demos-2.2.1/src/ftcommon.c:607
#12 0x0804b17c in main (argc=0, argv=0xbfcc5610) at
/root/src/freetype/ft2demos-2.2.1/src/ftview.c:276

2006/5/14, Werner LEMBERG <[EMAIL PROTECTED]>:


Now I have this font, and I can't manage to make ftview produce a
segfault.  Please report which compiler you use, which optimization
flags, etc., etc.  Try with a different optimization level; maybe it's
a compiler bug.


the orginal optimization level is -O2, but nothing changes after I removed it.
___
Freetype-devel mailing list
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel


[ft-devel] ftview/ftstring segfault with -e unic

2006-05-13 Thread Jjgod Jiang

Hi,

I'm using ftview/ftstring in ft2demos-2.2.1 to preview fonts. In most
of the cases it works fine, but when I try to use it with some OpenType
fonts like KozMinProVI-Regular.otf provided by Adobe Reader Asian Fonts
Pack (which is freely available from adobe.com). For example:

./ftview -e unic ppem KozMinProVI-Regular.otf

The window suddenly disappears with "Segmentation fault" as output.

but "./ftview ppem KozMinProVI-Regular.otf" works fine.

and ftview/ftstring in ft2demos-2.1.10 does not have this problem.

I'm pretty sure ftview/ftstring is linked with the correct version of freetype,
Is there any ways to troubleshot this? Or any other infomation I should
provide here?

Regards,
jjgod.


___
Freetype-devel mailing list
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel