[Fonts]New versions of mkfontscale and FreeType 2 backend

2002-04-17 Thread Juliusz Chroboczek

New versions of both mkfontscale and the FreeType 2 backend are
available from

  http://www.pps.jussieu.fr/~jch/software/files/

Note that you will need to apply the ``xfree86-freetype2.patch'' even
if you've done before, as this version contains a little more stuff.

I gratefully acknowledge the help of Ishikawa Mutsumi and James Cloos
for this version.

Changes in mkfontscale:

  - support for non-AGL Type 1 fonts (e.g. symbol fonts);
  - support for more Type 1 weights;
  - smarter handling of non-Unicode fonts.

Changes in the FreeType 2 backend:

  - fixes a crash when adding properties (due to Ishikawa Mutsumi);
  - support for OpenType/CFF fonts;
  - support for non-AGL Type 1 fonts;
  - support for custom Type 1 encodings (``adobe-fontspecific'');
  - minor fixes to Type 1 metrics (the problem with average width remains);
  - a number of minor cleanups.

I would need people to help me make mkfontscale smarter when working
with East-Asian encodings; I think some additions to the definition of
CODE_IGNORED are needed to do a decent job with Chinese encodings
(Japanese and Korean encodings seem to work with the current
heuristics).  If you think you're competent to give me a hand with
that, please do get in touch.

Juliusz
___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts



Re: [Fonts]New versions of mkfontscale and FreeType 2 backend

2002-04-17 Thread ISHIKAWA Mutsumi

Hi,

> In <[EMAIL PROTECTED]> 
>   Juliusz Chroboczek <[EMAIL PROTECTED]> wrote:
>> New versions of both mkfontscale and the FreeType 2 backend are
>> available from
>>
>>   http://www.pps.jussieu.fr/~jch/software/files/
>>
>> Note that you will need to apply the ``xfree86-freetype2.patch'' even
>> if you've done before, as this version contains a little more stuff.

 I saw the ``xfree86-freetype2.patch'', and I found it does not
contain ftstdlib.h related chank. It is still needed.

*** /dev/null   Thu Jan  1 01:00:00 1970
--- xc/extras/freetype2/include/ftstdlib.h  Wed Apr  3 23:43:43 2002
***
*** 0 
--- 1,18 
+ #ifndef _FT_STDLIB_H
+ #define _FT_STDLIB_H
+ #ifndef FONTMODULE
+ #include 
+ #include 
+ #include 
+ #include 
+ #else
+ #include "Xmd.h"
+ #include "Xdefs.h"
+ #include "xf86_ansic.h"
+ #endif
+ 
+ #ifndef offsetof
+ #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+ #endif
+ 
+ #endif

-- 
ISHIKAWA Mutsumi
 <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts



Re: [Fonts]New versions of mkfontscale and FreeType 2 backend

2002-04-17 Thread James H. Cloos Jr.

I'm running the new ft2 backend now for all scalled fonts.¹

Most everything looks good so far.  I've tried several different
fonts in mozilla, rxvt, gvim.

The average width error is still there for type1 fonts, but AFAICT
it affects very few programs that one usually doesn't notice.

SuSE patches the type1 backend to treak urw-fontspecific like
adobe-fontspecific.  (They also patch xftfreetype.c for this.)
Perhaps generalizing -adobe-fontspecific into -*-fontspecific
would be reasonable?  They have urw-fontspecific in:

/usr/share/ghostscript/fonts/fonts.dir

for the -URW-Dingbats- and -URW-Standard Symbols L- fonts.

I'm also having trouble adding /usr/lib/jdk1.3/jre/lib/fonts
to the font path.  It craps out with:

X Error of failed request:  86
  Major opcode of failed request:  51 (X_SetFontPath)
  Serial number of failed request:  8
  Current serial number in output stream:  10

which seems indicative of a broken fonts.dir.  Making a new fonts.dir
with mkfontscale;mkfontdir however did not solve that one.  I've tried
with both IBM Java 1.3's  and Sun/Blackdown 1.3.1's jre/lib/fonts.

Everything else looks great, though, whether t1, ttf or otf.

-JimC

¹ While the speedo backend is also loaded, the speedo fonts are not
  in the fontpath.  Useful, eh? :)

___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts



Re: [Fonts]New versions of mkfontscale and FreeType 2 backend

2002-04-17 Thread Yu Shao

Hi Juliusz,

Red Hat will use a updated ttmkfdir in the next release, we updated the 
ttmkfdir to FreeType2 and also added some other CJK releated 
features(like TTCap), and it uses system encodings.dir as default to 
recognize font encodings.

If anyone has interests, please have a look of 
http://people.redhat.com/yshao, I can also provide any help you need.

Another thing is we really see some real needs of TrueType embedded 
bitmap feature support in mainland China at the moment, don't know if 
you have any plan to add this to the X freetype backend?  

Regards,

Yu Shao


Juliusz Chroboczek wrote:

>New versions of both mkfontscale and the FreeType 2 backend are
>available from
>
>  http://www.pps.jussieu.fr/~jch/software/files/
>
>Note that you will need to apply the ``xfree86-freetype2.patch'' even
>if you've done before, as this version contains a little more stuff.
>
>I gratefully acknowledge the help of Ishikawa Mutsumi and James Cloos
>for this version.
>
>Changes in mkfontscale:
>
>  - support for non-AGL Type 1 fonts (e.g. symbol fonts);
>  - support for more Type 1 weights;
>  - smarter handling of non-Unicode fonts.
>
>Changes in the FreeType 2 backend:
>
>  - fixes a crash when adding properties (due to Ishikawa Mutsumi);
>  - support for OpenType/CFF fonts;
>  - support for non-AGL Type 1 fonts;
>  - support for custom Type 1 encodings (``adobe-fontspecific'');
>  - minor fixes to Type 1 metrics (the problem with average width remains);
>  - a number of minor cleanups.
>
>I would need people to help me make mkfontscale smarter when working
>with East-Asian encodings; I think some additions to the definition of
>CODE_IGNORED are needed to do a decent job with Chinese encodings
>(Japanese and Korean encodings seem to work with the current
>heuristics).  If you think you're competent to give me a hand with
>that, please do get in touch.
>
>Juliusz
>___
>Fonts mailing list
>[EMAIL PROTECTED]
>http://XFree86.Org/mailman/listinfo/fonts
>



___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts



Re: [Fonts]New versions of mkfontscale and FreeType 2 backend

2002-04-18 Thread James H. Cloos Jr.

I jus realized that there is a significant difference with the new ft2
backend.  I've lost underlining in mozilla.  I've verified that the
underlines are there when it uses its xft2 engine, but disappear with
server-side fonts.  (Something was bothering me about it last night,
but I couldn't put my finger on it until this morning.)

Oddly, though, the underlines do show up in netscape 4.7.  I'm not yet
sure why there is a difference.  I'll keep hunting

-JimC

___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts



Re: [Fonts]New versions of mkfontscale and FreeType 2 backend

2002-04-18 Thread Juliusz Chroboczek

YS> Red Hat will use a updated ttmkfdir in the next release, we
YS> updated the ttmkfdir to FreeType2 and also added some other CJK
YS> releated features(like TTCap), and it uses system encodings.dir as
YS> default to recognize font encodings.

Mkfontscale does all of that except for TTCap (which I won't
implement).  The main advantage of mkfontscale is that it uses the
very same encoding database as the FreeType backend -- which ensures
utmost consistency between the two.

YS> Another thing is we really see some real needs of TrueType
YS> embedded bitmap feature support in mainland China at the moment,
YS> don't know if you have any plan to add this to the X freetype
YS> backend?

It is my understanding that this happens automatically if you use
FreeType 2; please correct me if I'm wrong.

Juliusz


___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts



Re: [Fonts]New versions of mkfontscale and FreeType 2 backend

2002-04-18 Thread Juliusz Chroboczek

IM>  I saw the ``xfree86-freetype2.patch'', and I found it does not
IM> contain ftstdlib.h related chank. It is still needed.

Thanks for the report.  I forgot ``-N''.

I'll generate a new patch ASAP.

Juliusz
___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts



Re: [Fonts]New versions of mkfontscale and FreeType 2 backend

2002-04-18 Thread Juliusz Chroboczek

JC> I'm running the new ft2 backend now for all scalled fonts.
JC> Most everything looks good so far.

Great to know.

JC> Perhaps generalizing -adobe-fontspecific into -*-fontspecific
JC> would be reasonable?

Fine.  Although mkfontscale will still only generate `adobe-fontspecific'.

JC> I'm also having trouble adding /usr/lib/jdk1.3/jre/lib/fonts
JC> to the font path.

Permissions?  NFS authorisation? (The server runs as root, not as you.)

I'll try to see if I can reproduce it.

Juliusz
___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts



Re: [Fonts]New versions of mkfontscale and FreeType 2 backend

2002-04-18 Thread Juliusz Chroboczek

JC> The average width error is still there for type1 fonts, but AFAICT
JC> it affects very few programs that one usually doesn't notice.

According to David Turner, this may be a bug in FreeType 2.0.9 that
was fixed in 2.1.0.  I haven't had time to test his guess yet.

(Keith, what about importing 2.1.0?)

Juliusz

___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts



Re: [Fonts]New versions of mkfontscale and FreeType 2 backend

2002-04-18 Thread Keith Packard


Around 16 o'clock on Apr 18, Juliusz Chroboczek wrote:

> According to David Turner, this may be a bug in FreeType 2.0.9 that
> was fixed in 2.1.0.  I haven't had time to test his guess yet.

> (Keith, what about importing 2.1.0?)

I can do that; feel free to test with it and see if it does fix the 
problems.  Are you now using the regular .so for your server-side module?

Keith PackardXFree86 Core TeamCompaq Cambridge Research Lab


___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts



Re: [Fonts]New versions of mkfontscale and FreeType 2 backend

2002-04-18 Thread James H. Cloos Jr.

> "Juliusz" == Juliusz Chroboczek <[EMAIL PROTECTED]> writes:

JC> I'm also having trouble adding /usr/lib/jdk1.3/jre/lib/fonts to
JC> the font path.

Juliusz> Permissions?  NFS authorisation? (The server runs as root,
Juliusz> not as you.)

Not a permissions problem.  Everything is on hda.  Xft is able to
access those files.  I have taken another look.  The fonts.scale
generated by mkfontscale (20020417) assigned the same XLDF to more
than one ttf.  It also had bad weight values in the XLFDs.  (The
XftCache in that dir shows that all of the normal weight fonts are
weight=100 and the (demi)bold versions are all 200.  mkfontscale
returns a weight of thin for many but not all of the Lucida fonts
therein; it does get a couple of the right.)

I don't see that error in the ttmkfdir output, but there is probably
something of the sort

Both fonts.dir files result in exactly the same error, so there
probably *is* some problem with the ttmkfdir version as well.

-JimC




___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts



Re: [Fonts]New versions of mkfontscale and FreeType 2 backend

2002-04-19 Thread Juliusz Chroboczek

JC> I jus realized that there is a significant difference with the new
JC> ft2 backend.  I've lost underlining in mozilla.

Please check the values of the UNDERLINE_POSITION and UNDERLINE_WIDTH
properties (xlsfonts -ll -fn 'foo').

Juliusz


___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts



Re: [Fonts]New versions of mkfontscale and FreeType 2 backend

2002-04-19 Thread Juliusz Chroboczek

Keith Packard <[EMAIL PROTECTED]>:

KP> Are you now using the regular .so for your server-side module?

That's the plan ultimately (I wouldn't dare disobey Keith), but it's
still premature for two reasons.

I'm currently using two internal interfaces, which I don't wish to
export to server modules.  I'll first need to modify FreeType to make
the data I need available legally, and then get the nice FreeType
hackers to bless my new interfaces (and, knowing them, to change them
completely in the process).

I also need to modify FreeType to behave reliably in the default Linux
build by falling back to fread if mmap failes.  I'm just not willing
to deal with the bug reports I'll receive if I don't do that.

Juliusz

P.S. In case you missed either of the discussions,

  http://www.freetype.org/pipermail/freetype/2002-April/002121.html
  http://www.freetype.org/pipermail/freetype/2002-April/002053.html
___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts



Re: [Fonts]New versions of mkfontscale and FreeType 2 backend

2002-04-19 Thread Keith Packard


Around 17 o'clock on Apr 19, Juliusz Chroboczek wrote:

> I'm currently using two internal interfaces, which I don't wish to
> export to server modules.

(from old mail...)

>   (i) to determine whether a font uses glyph names or Unicode indices
>   as its native encoding format (only Type 1 fonts fall into the
>   former category currently);

I need this as well to fix MathML mode in Mozilla when using Xft.  I 
believe it would be sufficient (if not exact) to simply check for type1 
fonts, with the possible exception of OpenType fonts translated directly 
from Type1 fonts.  I don't know how you'd check for that case though.

As for accessing the source-specific fields in the font, I've had the PCF 
FreeType developer suggest that as the "standard" way of getting at such 
information.  I'd rather have APIs that returned the private structure
from a font (null if the wrong type) so that a magic strcmp wasn't 
necessary, and so that the library could transcode the information from 
OpenType (or other "wrapper" font formats) if available.  As long as those 
datastructures appear in the public API for FreeType, they shouldn't 
change without a major library version number change.

Keith PackardXFree86 Core TeamCompaq Cambridge Research Lab


___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts



Re: [Fonts]New versions of mkfontscale and FreeType 2 backend

2002-04-19 Thread James H. Cloos Jr.

JC> I just realized that there is a significant difference with the new
JC> ft2 backend.  I've lost underlining in mozilla.

Juliusz> Please check the values of the UNDERLINE_POSITION and
Juliusz> UNDERLINE_WIDTH properties (xlsfonts -ll -fn 'foo').

With Georgia, UNDERLINE_POSITION is O(-PIXEL_SIZE/10) and thickness
is O(PIXEL_SIZE/20).  Other ttf and otf fonts seem to be the same.

With type1 fonts, the UNDERLINE_POSITION is O(PIXEL_SIZE/10).  I
presume the sign is then the problem. ... ...  Yup.  The underlines
reappear when I choose a type1 font.  I thought I tested that, but
obviously I didn't do so thoroughly. :(

-JimC

___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts



Re: [Fonts]New versions of mkfontscale and FreeType 2 backend

2002-04-24 Thread Rui-Xiang Guo

> Changes in mkfontscale:
>
>  - support for non-AGL Type 1 fonts (e.g. symbol fonts);
>  - support for more Type 1 weights;
>  - smarter handling of non-Unicode fonts.

Hi, all. First thing to say: if this mail is redundant, I am sorry.
I have posted two mails before but no exist on this list so I try again.

I just tested mkfontscale-20020418 and felt it is pretty good. :)
But I found some problem: (I tested it with Arphic TTF which be distributed
with most Linux distributions and all *BSD.)
1) Here is the fonts.scale:
bsmi00lp.ttf -arphic-AR PL Mingti2L Big5-medium-r-normal--0-0-0-0-p-0-iso10646-1
bkai00mp.ttf -arphic-AR PL KaitiM Big5-medium-r-normal--0-0-0-0-p-0-iso10646-1
gkai00mp.ttf -arphic-AR PL KaitiM GB-medium-r-normal--0-0-0-0-p-0-gb2312.1980-0
gkai00mp.ttf -arphic-AR PL KaitiM GB-medium-r-normal--0-0-0-0-p-0-iso10646-1
gbsn00lp.ttf -arphic-AR PL SungtiL GB-medium-r-normal--0-0-0-0-p-0-gb2312.1980-0
gbsn00lp.ttf -arphic-AR PL SungtiL GB-medium-r-normal--0-0-0-0-p-0-iso10646-1

but it miss two lines for Big5 encoding fonts:
bsmi00lp.ttf -arphic-AR PL Mingti2L Big5-medium-r-normal--0-0-0-0-p-0-big5-0
bkai00mp.ttf -arphic-AR PL KaitiM Big5-medium-r-normal--0-0-0-0-p-0-big5-0

It seems the problem of FT_Get_Char_Index() in checkEncoding().
I think you could fixed this for us to save my time free from hacking work. ;)

2) After I add that two lines by hand, I still have to edit the fonts.alias
file for running rxvt. The sample for 16 pixel fonts is:
"-aliasarphic-AR PL Mingti2L Big5-medium-r-normal--16-160-0-0-p-160-big5-0" 
"-arphic-AR PL Mingti2L Big5-medium-r-normal--16-160-0-0-p-160-big5-0"

The other two GB encoding fonts seems don't need fonts.alias file.

3) Besides that, I need to fix the spacing value 'p' to 'c' because the
value 'p' will cause delay in several seconds when start-up rxvt.
Don't know why. X-)

The other two GB encoding fonts seems don't need fix the value.

However, thanks for your program!
Would it be merged into next XFree snapshot?

-rxg
___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts



Re: [Fonts]New versions of mkfontscale and FreeType 2 backend

2002-04-26 Thread Rui-Xiang Guo

> It seems the problem of FT_Get_Char_Index() in checkEncoding().

Hi, I just do the quick testing work with this:
--- mkfontscale.c.orig  Wed Apr 24 16:47:01 2002
+++ mkfontscale.c   Fri Apr 26 22:39:18 2002
@@ -36,6 +36,7 @@
 #include "freetype/internal/ftobjs.h"
 #include "freetype/internal/t1types.h"
 #include "freetype/ftmodule.h"
+#include "freetype/internal/sfnt.h"
 
 #define FACE_TYPE(FACE) ((FACE)->driver->clazz->root.module_name)
 #define T1INFO(FACE) \
@@ -58,7 +59,7 @@
   "adobe-standard", "adobe-symbol", "ibm-cp437", "microsoft-cp1252",
   /* But not "adobe-dingbats", as it uses generic glyph names. */
   "jisx0201.1976-0", "jisx0208.1983-0", "jisx0208.1990-0",
-  "jisx0212.1190-0", "big5.eten-0", "gb2312.1980-0",
+  "jisx0212.1990-0", "big5-0", "gb2312.1980-0",
   "ksc5601.1987-0", "ksc5601.1992-3"};
 
 char *extra_encodings_array[] =
@@ -498,6 +499,7 @@
 int i, j, c, koi8;
 char *n;
 FT_CharMap cmap;
+TT_CMapTable* ttcmap;
 
 encoding = FontEncFind(encoding_name, NULL);
 if(!encoding)
@@ -542,7 +544,13 @@
 if(CODE_IGNORED(c)) {
 continue;
 } else {
-if(FT_Get_Char_Index(face, c) == 0) {
+if(face && face->charmap) {
+ttcmap = &((TT_CharMap)face->charmap)->cmap;
+if(ttcmap->get_index)
+/* if(ttcmap->get_index(ttcmap, c) == 0)
+return 0; */
+return ttcmap->get_index(ttcmap, c);
+} else {
 return 0;
 }
 }

then I get another fonts.scale file:
28
bsmi00lp.ttf -arphic-AR PL Mingti2L Big5-medium-r-normal--0-0-0-0-p-0-jisx0208.1
983-0
bsmi00lp.ttf -arphic-AR PL Mingti2L Big5-medium-r-normal--0-0-0-0-p-0-jisx0208.1
990-0
bsmi00lp.ttf -arphic-AR PL Mingti2L Big5-medium-r-normal--0-0-0-0-p-0-big5-0
bsmi00lp.ttf -arphic-AR PL Mingti2L Big5-medium-r-normal--0-0-0-0-p-0-gb2312.198
0-0
bsmi00lp.ttf -arphic-AR PL Mingti2L Big5-medium-r-normal--0-0-0-0-p-0-ksc5601.19
87-0
bsmi00lp.ttf -arphic-AR PL Mingti2L Big5-medium-r-normal--0-0-0-0-p-0-ksc5601.19
92-3
bsmi00lp.ttf -arphic-AR PL Mingti2L Big5-medium-r-normal--0-0-0-0-p-0-iso10646-1...

What't the secret in get_index()? X-)

> 2) After I add those two lines by hand, I still have to edit the fonts.alias
> file for running rxvt. The sample for 16 pixel fonts is:
...
The other two GB encoding fonts also need it.
Maybe we need a script to generate it.

> 3) Besides that, I need to fix the spacing value 'p' to 'c' because the
> value 'p' will cause delay in several seconds when start-up rxvt.
...
The other two GB encoding fonts also get the same situation...

-rxg
___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts



Re: [Fonts]New versions of mkfontscale and FreeType 2 backend

2002-04-26 Thread Juliusz Chroboczek

CC'd to Freetype.

Rui-Xiang Guo <[EMAIL PROTECTED]>:

RG> -  "jisx0212.1190-0", "big5.eten-0", "gb2312.1980-0",
RG> +  "jisx0212.1990-0", "big5-0", "gb2312.1980-0",

Okay, in next version.  Thanks.

RG> (I tested it with Arphic TTF which be distributed with most Linux
RG> distributions and all *BSD.)

Hmm, there may be problems with this font; I'm told it has bugs.
Maybe the FreeType folks can comment?

RG> It seems the problem of FT_Get_Char_Index() in checkEncoding().

RG> -if(FT_Get_Char_Index(face, c) == 0) {
RG> +if(face && face->charmap) {
RG> +ttcmap = &((TT_CharMap)face->charmap)->cmap;
RG> +if(ttcmap->get_index)
RG> +/* if(ttcmap->get_index(ttcmap, c) == 0)
RG> +return 0; */
RG> +return ttcmap->get_index(ttcmap, c);

Very curious.  I'll try to understand what's going on.

RG> 3) Besides that, I need to fix the spacing value 'p' to 'c' because the
RG> value 'p' will cause delay in several seconds when start-up rxvt.

Again, that's a font bug; mkfontscale tries to work out which fonts
are proportional.  On the other hand, it doesn't yet implement a
heuristic to distinguich monospaced (-m-) from charcell (-c-) fonts.

I guess a suitable heuristic would be to decalare all monospaced fonts
in East-Asian encodings to be charcell.

RG> Would it be merged into next XFree snapshot?

I hope so.

Thanks,

Juliusz
___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts



Re: [Fonts]New versions of mkfontscale and FreeType 2 backend

2002-04-26 Thread Juliusz Chroboczek

JC> With type1 fonts, the UNDERLINE_POSITION is O(PIXEL_SIZE/10).  I
JC> presume the sign is then the problem.

Thanks a lot for the debugging -- fix in next version.

Juliusz
___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts



Re: [Fonts]New versions of mkfontscale and FreeType 2 backend

2002-05-24 Thread Rui-Xiang Guo

> RG> 3) Besides that, I need to fix the spacing value 'p' to 'c' because the
> RG> value 'p' will cause delay in several seconds when start-up rxvt.
> 
> Again, that's a font bug; mkfontscale tries to work out which fonts
> are proportional.  On the other hand, it doesn't yet implement a
> heuristic to distinguich monospaced (-m-) from charcell (-c-) fonts.

Hi,
I tested your program with another two Chinese ttf from win9x -
MINGLIU.TTC and KAIU.TTF, here is the result:

MINGLIU.TTC -dynalab-MingLiU-medium-r-normal--0-0-0-0-m-0-iso8859-1
MINGLIU.TTC -dynalab-MingLiU-medium-r-normal--0-0-0-0-m-0-iso10646-1
KAIU.TTF -dynalab-DFKai-SB-medium-r-normal--0-0-0-0-m-0-iso8859-1
KAIU.TTF -dynalab-DFKai-SB-medium-r-normal--0-0-0-0-m-0-iso10646-1

It looks better then I added this line by hand:
MINGLIU.TTC -dynalab-MingLiU-medium-r-normal--0-0-0-0-m-0-big5-0

The spacing value 'm' still will cause delay with rxvt. Don't know why. :)
The CJK ttf seem must use the 'c' value to avoid this problem.
ps. how to fix the font's bugs if I want?
maybe fixing this program will be much easy. :)

> I guess a suitable heuristic would be to decalare all monospaced fonts
> in East-Asian encodings to be charcell.

How about using os2->ulCodePageRange1 to lookup the font encoding for supporting
modren Unicode encoded CJK fonts? This idea is from another program.
Then set their spacing value to 'c'.
Here is a patch to do it:
--- mkfontscale.c.orig  Sat May 18 18:15:35 2002
+++ mkfontscale.c
@@ -37,6 +37,12 @@
 #include "freetype/internal/t1types.h"
 #include "freetype/ftmodule.h"
 
+#define TT_CODEPAGE_RANGE_932(1L << 17) /* JIS/Japan */
+#define TT_CODEPAGE_RANGE_936(1L << 18) /* Chinese: Simplified */
+#define TT_CODEPAGE_RANGE_949(1L << 19) /* Korean Wansung */
+#define TT_CODEPAGE_RANGE_950(1L << 20) /* Chinese: Traditional */
+#define TT_CODEPAGE_RANGE_1361   (1L << 21) /* Korean Johab */
+
 #define FACE_TYPE(FACE) ((FACE)->driver->clazz->root.module_name)
 #define T1INFO(FACE) \
   (strcasecmp(FACE_TYPE(FACE), "type1") == 0 ?\
@@ -58,7 +64,7 @@
   "adobe-standard", "adobe-symbol", "ibm-cp437", "microsoft-cp1252",
   /* But not "adobe-dingbats", as it uses generic glyph names. */
   "jisx0201.1976-0", "jisx0208.1983-0", "jisx0208.1990-0",
-  "jisx0212.1190-0", "big5.eten-0", "gb2312.1980-0",
+  "jisx0212.1990-0", "big5-0", "gb2312.1980-0",
   "ksc5601.1987-0", "ksc5601.1992-3"};
 
 char *extra_encodings_array[] =
@@ -69,7 +75,7 @@
 #define countof(_a) (sizeof(_a)/sizeof((_a)[0]))
 
 int doDirectory(char*);
-static int checkEncoding(FT_Face face, char *encoding_name);
+static int checkEncoding(FT_Face face, char *encoding_name, TT_OS2 *os2);
 static int checkExtraEncoding(FT_Face face, char *encoding_name, int found);
 static int find_cmap(int type, int pid, int eid, FT_Face face, 
  FT_CharMap *cmap_return);
@@ -456,7 +462,12 @@
 if(!spacing) spacing = "p";
 
 for(encoding = encodings; encoding; encoding = encoding->next)
-if(checkEncoding(face, encoding->value)) {
+if(checkEncoding(face, encoding->value, os2)) {
+if((strncmp("jis", encoding->value, 3) == 0) ||
+   (strncmp("big5", encoding->value, 4) == 0) ||
+   (strncmp("gb", encoding->value, 2) == 0) ||
+   (strncmp("ksc", encoding->value, 3) == 0))
+spacing = "c";
 found = 1;
 entries = listConsF(entries,
 "%s -%s-%s-%s-%s-%s-%s-0-0-0-0-%s-0-%s",
@@ -491,7 +502,7 @@
 }
 
 static int
-checkEncoding(FT_Face face, char *encoding_name)
+checkEncoding(FT_Face face, char *encoding_name, TT_OS2 *os2)
 {
 FontEncPtr encoding;
 FontMapPtr mapping;
@@ -542,6 +553,18 @@
 if(CODE_IGNORED(c)) {
 continue;
 } else {
+if((strcmp(encoding->name, "jisx0208.1983-0")==0) &
&
+   (os2->ulCodePageRange1 & TT_CODEPAGE_RANGE_932))
+return 1;
+if((strcmp(encoding->name, "big5.eten-0")==0) &&
+   (os2->ulCodePageRange1 & TT_CODEPAGE_RANGE_950))
+return 1;
+if((strcmp(encoding->name, "gb2312.1980-0")==0) &&
+   (os2->ulCodePageRange1 & TT_CODEPAGE_RANGE_936))
+return 1;
+if((strcmp(encoding->name, "ksc5601.1987-0")==0) &&
+   (os2->ulCodePageRange1 & TT_CODEPAGE_RANGE_949))
+return 1;
 if(FT_Get_Char_Index(face, c) == 0) {
 return 0;
 }
(END)
After adopting this patch, I test it with arphic ttf again,
the result is what I need:
gkai00

Re: [Fonts]New versions of mkfontscale and FreeType 2 backend

2002-05-24 Thread Juliusz Chroboczek

Thanks for the report and the suggestions.

RG> It looks better then I added this line by hand:
RG> MINGLIU.TTC -dynalab-MingLiU-medium-r-normal--0-0-0-0-m-0-big5-0

Yu Shao has just suggested to me the following heuristic for CJK
fonts: an encoding is supported by the font if fewer than 2% of the
glyphs are missing.  I'm going to implement this scheme, and Big-5
encodings should be properly generated in the next version.

RG> The spacing value 'm' still will cause delay with rxvt. Don't know why. :)

There's an optimisation (hack) for charcell (as opposed to monospaced)
fonts in the FreeType backend.  The delay you're seeing is what
happens when we don't apply said hack.

RG> How about using os2->ulCodePageRange1 to lookup the font encoding
RG> for supporting modren Unicode encoded CJK fonts?

I need to think about it some more.  What if Microsoft comes up with
Courier New Unicode?

I'm more tempted to peek at the font's bounding box to determine if
it's charcell.  I'll need to check whether this gives good results.

Juliusz
___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts