Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #1944 > unrolled thread

Postscript output with a unicode font character from a non-built in font

Started byidol programmer <idprog@trust.com>
First post2014-08-04 14:44 +0100
Last post2014-08-06 11:30 +0100
Articles 5 — 3 participants

Back to article view | Back to comp.lang.postscript


Contents

  Postscript output with a unicode font character from a non-built in font idol programmer <idprog@trust.com> - 2014-08-04 14:44 +0100
    Re: Postscript output with a unicode font character from a non-built in font ken <ken@spamcop.net> - 2014-08-04 15:14 +0100
      Re: Postscript output with a unicode font character from a non-built in font rodd@panix.com (Rod Dorman) - 2014-08-04 20:06 +0000
        Re: Postscript output with a unicode font character from a non-built in font ken <ken@spamcop.net> - 2014-08-05 13:28 +0100
          Re: Postscript output with a unicode font character from a non-built in font idol programmer <idprog@trust.com> - 2014-08-06 11:30 +0100

#1944 — Postscript output with a unicode font character from a non-built in font

Fromidol programmer <idprog@trust.com>
Date2014-08-04 14:44 +0100
SubjectPostscript output with a unicode font character from a non-built in font
Message-ID<53df8e33$0$2741$c3e8da3$66d3cc2f@news.astraweb.com>
Hello,  I am generating a postscript print file from my application 
(it's a fairly simple report with text and grid lines etc. on it).

One of the characters required on the report is character 8597  (in hex 
2195) from the Windows font  "Arial"  which is an arrow with up and down 
arrow heads and this is also a standard unicode character U+2195. 
http://www.fileformat.info/info/unicode/char/2195/index.htm

How should I go about printing this character from Postscript?

At the moment I've done a workaround where I have used postscript moveto 
+ stroke commands to reproduce the lines that make up the arrow,  but it 
doesn't look exactly the same as the Arial Glyph which has nice rounded 
curves on the arrow heads.

What's the proper way of doing this sort of thing?

I suspect I need to embed the font somehow and then do a print command 
to output the character 8597, but I'm not quite sure on the syntax for 
any of that.

Does anyone have any suggestions / pointers / examples please?

Thanks,

Richard

[toc] | [next] | [standalone]


#1945

Fromken <ken@spamcop.net>
Date2014-08-04 15:14 +0100
Message-ID<MPG.2e49a5934cbfe069898c3@usenet.plus.net>
In reply to#1944
In article <53df8e33$0$2741$c3e8da3$66d3cc2f@news.astraweb.com>, 
idprog@trust.com says...

 
> How should I go about printing this character from Postscript?

First you need to embed the font. Assuming you are using the Windows 
TrueType font you will need to convert the font to a type 42, and 
include the type 42 font in the PostScript file.

As part of this exercise you will need to re-encode the font so that the 
character code you want to use in the PostScript to draw this glyph maps 
to the relevant glyph program in the Type 42 font.

The font's Encoding maps character codes to glyph names, the Charstrings 
dictionary contains a number of key/value pairs, where the key is the 
glyphg name and the value is the GID of the glyph you want to draw. So 
you need to ensure that the mapping "character code->glyph name ->GID" 
results in whatever the GID is for the glyph you want to draw, in the 
font in question (Note, *none* of this is anythign to do with Unicode, 
though the TTF may contain a Unicode CMAP table, which will at least 
allow you to discover what the GID for the glyph relating to the given 
Unicode code point is).

Then you simply select and scale the font, then 'show' the character 
code which maps to that glyph, just as you would for any other glyph.

As you've probably guessed by now, this isn't entirely simple to get 
right, and you will need a working knowledge of PostScript fonts as 
well, in order to get things like the FontMatrix correct (for example, 
the PostScript font design grid is usually 1000x1000, whereas the 
TrueType design grid is usually 2048x2048)


		Ken


Some possibly useful liks:

You will almost certainly need a copy of the Adobe Tech note 5012 "The 
Type 42 Font Format Specification"

http://www.adobe.com/content/dam/Adobe/en/devnet/font/pdfs/5012.Type42
_Spec.pdf


See also ttftotype42:

http://www.lcdf.org/type/

But I've never used this and don't know if it will give you the control 
you will need. If nothign else you can look at the output from it and 
learn how to make a type 42 font.

And:
http://www.ctan.org/tex-archive/fonts/utilities/TrueTypeToType42

This one will require you to have a copy of Ghostscript, as it relies on 
GS to do a lot of the work.

[toc] | [prev] | [next] | [standalone]


#1946

Fromrodd@panix.com (Rod Dorman)
Date2014-08-04 20:06 +0000
Message-ID<lrop4g$9am$1@reader1.panix.com>
In reply to#1945
In article <MPG.2e49a5934cbfe069898c3@usenet.plus.net>,
ken  <ken@spamcop.net> wrote:
>In article <53df8e33$0$2741$c3e8da3$66d3cc2f@news.astraweb.com>, 
>idprog@trust.com says...
>> How should I go about printing this character from Postscript?
>
>First you need to embed the font. Assuming you are using the Windows 
>TrueType font you will need to convert the font to a type 42, and 
>include the type 42 font in the PostScript file.
>
>As part of this exercise you will need to re-encode the font so that the 
>character code you want to use in the PostScript to draw this glyph maps 
>to the relevant glyph program in the Type 42 font.
>
>The font's Encoding maps character codes to glyph names, the Charstrings 
>dictionary contains a number of key/value pairs, where the key is the 
>glyphg name and the value is the GID of the glyph you want to draw. So 
>you need to ensure that the mapping "character code->glyph name ->GID" 
>results in whatever the GID is for the glyph you want to draw, in the 
>font in question (Note, *none* of this is anythign to do with Unicode, 
>though the TTF may contain a Unicode CMAP table, which will at least 
>allow you to discover what the GID for the glyph relating to the given 
>Unicode code point is).
>
>Then you simply select and scale the font, then 'show' the character 
>code which maps to that glyph, just as you would for any other glyph.

Note that if the glyph you want isn't mapped in the Encoding array you
can avoid needing to reencode by using the glyphshow command.

-- 
					-- Rod --
rodd(at)polylogics(dot)com

[toc] | [prev] | [next] | [standalone]


#1947

Fromken <ken@spamcop.net>
Date2014-08-05 13:28 +0100
Message-ID<MPG.2e4ade16db108ad69898c4@usenet.plus.net>
In reply to#1946
In article <lrop4g$9am$1@reader1.panix.com>, rodd@panix.com says...

> >Then you simply select and scale the font, then 'show' the character 
> >code which maps to that glyph, just as you would for any other glyph.
> 
> Note that if the glyph you want isn't mapped in the Encoding array you
> can avoid needing to reencode by using the glyphshow command.


I would avoid using glyphshow, though some applications make extensive 
use of it. 

You can't use any of the variants of show when you use this, and if you 
are intending to run to a 'high level' output such as Ghostscript's 
pdfwrite device, it can't be attached to the font being created for the 
remaining text (because the glyph name isn't present in the Encoding, 
and the Encoding may be completely full, so we can't add the glyph.

If you're going to all the troulbe of manufacturing a Type 42 font, I'd 
make sure the Encoding covers the glyphs you need and not rely on 
glyphshow.


		Ken

[toc] | [prev] | [next] | [standalone]


#1949

Fromidol programmer <idprog@trust.com>
Date2014-08-06 11:30 +0100
Message-ID<53e203e7$0$2837$c3e8da3$66d3cc2f@news.astraweb.com>
In reply to#1947
Thanks for all the info so far.   I'll let you know how I get on.



[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.postscript


csiph-web