Re: [NTG-context] Not embedding CID fonts (was: Re: What's the ps_name ...)

2007-12-31 Thread Martin Schröder
2007/12/29, Arthur Reutenauer [EMAIL PROTECTED]:
 each subfont.  Since it's an example file, I only wrote the CMap's for
 the Unicode rows U+51XX, U+66XX and U+67XX, so you would have to enhance
 it if you want to use the other Chinese characters.  It's easy to do,
 but it's a further inconvenience of this approach, since it means you
 have to embed a CMap which weigh 2 to 5 KB for each Unicode row (that
 is, up to 256 characters).

Amazing work.

I wonder at the /Flags 12, though: Symbolic Script. %-)
Although I doubt that any value of /Flags entry will work in your
case, is the 12 just coincidence or does it have meaning?

Best
   Martin
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Not embedding CID fonts (was: Re: What's the ps_name ...)

2007-12-31 Thread Arthur Reutenauer
 Amazing work.

  Thanks :-)

 I wonder at the /Flags 12, though: Symbolic Script. %-)

  I based myself on the PDF reference, that says Symbolic means
contains glyphs outside the Adobe standard Latin character set (page
458 of http://www.adobe.com/devnet/acrobat/pdfs/pdf_reference_1-7.pdf --
although it's formally contradicted by the pdfTeX manual ;-)  This is
definitely the case here, so I set that on purpose.  The bit 2 is set on
purpose too, since Ming / Song style is more or less a Serif sort of
font.  But now I realize I should have set Flags to 6 = 2^(2-1) +
2^(3-1) instead of 12 = 2^2 + 2^3.

  Anyway, as you say, the font flags are probably unusable here.

Happy New Year everyone!

Arthur
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Not embedding CID fonts (was: Re: What's the ps_name ...)

2007-12-30 Thread Arthur Reutenauer
Hello Zhichu and all,

 Thanks Hans. Do you have any comments about how to now embed the standard
 Adobe CJK fonts?

  I made experiments with pdfTeX in order to produce a file with Chinese
text without embedding the font.  It actually works---with minor
inconvenients---and I attach a small example file which uses
AdobeMingStd-Light.  It should of course be possible to adapt it for the
Adobe font for Simplified Chinese (AdobeSongStd-Light), as well as for
Japanese or Korean.

  Here is how you should use it:

  - Produce the TFM files for the subfonts of AdobeMingStd-Light.  You
should call them uni-adobe-ming-XX.tfm where XX is the number of the
Unicode row (the range from U+XX00 to U+XXFF);  I guess you know how
to do that.

  - Find a way to deactivate mktexpk somehow: the point is that my
macros emulate the subfonts in PDF directly, but pdfTeX doesn't know
that and wants to find the glyphs somewhere.  Since they're not
present anywhere, he calls mktexpk as a last resort, but that fails
as well and it's only a waste of time.  So you need to simply
deactivate mktexpk (I hope it's not an inconvenience for you and you
don't rely on PK generation otherwise).  When running on a shell on
Unix I can say export MKTEXPK=echo (and the call to mktexpk is
replaced by a simple echo).  There may be options in mktex.cnf or
mktex.opt which would enable you to set things
platform-independently, but I couldn't find anything useful.

On the other hand, if you can't do that, it also works but you waste
some time in the process.

  The central idea of my macros is to use CIDFont's, a concept
introduced by Adobe for its CJKV fonts, as I'm sure you know.  The point
is that all of the standard Adobe CJKV fonts are CIDFont's and use a
special kind of encoding called CID encoding, which is quite distinct
from encoding based on glyph names as used by Type 1 fonts.  I think
this is why your attempts by using .enc files didn't work; I strongly
suspect it's not possible at all to use .enc files with CIDFont's, and
you have to use the equivalent concept for CID encoding, that is CMap.
This is what I have done here, by embedding the appropriate CMap for
each subfont.  Since it's an example file, I only wrote the CMap's for
the Unicode rows U+51XX, U+66XX and U+67XX, so you would have to enhance
it if you want to use the other Chinese characters.  It's easy to do,
but it's a further inconvenience of this approach, since it means you
have to embed a CMap which weigh 2 to 5 KB for each Unicode row (that
is, up to 256 characters).

  I hope it works for you.  I also attach the output by pdfTeX on my machine.

  Obviously this is somewhat cumbersome in pdfTeX and would be much
easier to do with LuaTeX (where you don't need subfonts at all), but I
didn't look into that.  XeTeX wouldn't work the same way since you can't
write PDF objects directly the way I've done it.

Arthur
% engine=pdftex

% Example ConTeXt macros for using Adobe Reader's default Traditional Chinese
% font AdobeMingStd-Light without embedding it in the PDF file.
% © A. Reutenauer, December 2007.  Brest, Paris, Strasbourg, Opio.
% This file is distributed under the terms of the WTF Public License
% (http://sam.zoy.org/wtfpl/)

% It must be used with pdfTeX: the macros very strongly depends on some pdfTeX
% primitives.  They would probably work with LuaTeX which inherits them,
% although it's a complete waste of resources (LuaTeX doesn't need subfonts at
% all, which are used heavily here).  They would, on the other hand, most
% certainly *not* work with XeTeX (and would be just as pointless as with
% LuaTeX).

% The file is UTF-8-encoded!
\enableregime[utf8]

% We use the chi-00 module with slight modifications in one macro, at the very
% end of that file, before the text starts.
\usemodule[chi-00]

% This overrides the default ConTeXt settings and defines the “template” for
% TFM fonts: uni-adobe-ming-XX (where XX is the Unicode “row” number).
% We need to first produce the corresponding TFM files somehow.
\definefontsynonym [ChineseRegular][uni-adobe-ming-][encoding=cjk-uni]

% Counters for PDF object numbers (this is where the fun begins!)
\newcount\cidfontobj
\newcount\subfontobj
\newcount\fontdescobj
\newcount\cmapobj

% Three \if's: true/false whether the subfont has already been embedded or not.
% For the moment we only support 3 Unicode rows: U+51XX, U+66XX and U+67XX
% 
% Yes, this is completely ad-hoc code :-)  It's only meant as a proof of
% concept.  It doesn't even know about hex digits, by the way: in TeX's mind,
% 51, 66 and 67 are actually decimal number (which is why I used U+51E0 几 in
% the sample text, and not the—in my opinion more correct—character U+5E7E 幾).
%
% But of course, it can be improved an enhanced a lot.
\newif\ifli\lifalse
\newif\iflxvi\lxvifalse
\newif\iflxvii\lxviifalse

% --- The actual font data ---

% -- Global things --

% First we need a CIDFont