Skip to main content
Known Participant
July 22, 2008
Question

stroke and fill

  • July 22, 2008
  • 45 replies
  • 10666 views
I read in the PostScript documentation and i saw that stroke only has :
-linecap
-color
-mitterlimit
-linejoin
-thickness

I have to write an application and my class
Stroke, that i am using, has a lot of other stuff like PatternBrush, ImageBrush ,GradientBrush , etc.

Can i get this kind of options for stroke in a PostScript file?
How about Fill?
(I'm very interested in the gradient option. I haven't found so far very clear documentation about it)

Can I get a detailed explanation or(and) some reference?

[later edit]
Also, can i modify the matrix in one command (without using rotate, scale and translate).I bumped to this only when i was dealing with images and i haven't found something clear in the documentation about how can i do this just by a command. For now i just want to draw from the upper left corner of the page, but i will need it for other stuff too.

David
This topic has been closed for replies.

45 replies

Known Participant
July 31, 2008
And third :) ....

when I write in the ps file the font bytes, how should I do that?
Firstly, hexadecimal encoding, and after that should I organize the snfts entry in < > pieces ?

David.
Known Participant
July 31, 2008
And another thing (still kind of simple) ...

When I start a new page do I have to reset the configurations that I made on the previous page?

By that I mean ... if I have to reset current config ... etc or they don't maintain their values from page to page.I mean is there something in the graphic state that remain?

David.
Known Participant
July 31, 2008
>Now you know how to correct your matrix, and you can construct other >matrices for rotation, for skew, etc.
>Miklos

Ok, I just saw your post and is not the form of the matrix representation that I don't get ... but the way I'm suppose to use the transformation matrix to display the text as wanted.

That is true that mirrors the things that I am drawing, so the text appears upside-down.

Is there a kind of transformation matrix for text display?

David.
August 1, 2008
<David_Cristian@adobeforums.com> wrote in message <br />news:59b5e90e.40@webcrossing.la2eafNXanI...<br />> ...<br />> That is true that mirrors the things that I am drawing, so<br />> the text appears upside-down.<br /><br />Yes, the CTM affect everything, including text.<br /><br />><br />> Is there a kind of transformation matrix for text display?<br /><br />Something close: see the 'makefont' operator in the PostScript Language <br />Reference Manual. You can use it to mirror the glyphs in the font; this, <br />combined with the mirroring of the user space done by the CTM, results in <br />glyphs printed normally. This way you don't need to change and restore the <br />CTM each time you show a piece of text.
Known Participant
July 29, 2008
Ok, I read my question again and it's stupid ...
What I really don't understand is how the Encoding array depends on the font that the program wants to use?

...

In my example in the previous post I got that the program simply encodes the 0 with 0, by using /c00 and for me it doesn't make sense and I want to know what I don't get so I can go further ....

David.
Participating Frequently
July 29, 2008
The font itself includes a set of characters (glyphs), each of which
has a name. In the most common case they will have names like a,b,c,
A,B,C, three, comma, and so forth. The encoding MUST use the names
actually found in the font.

If you have a font program that uses names c00, c01, etc. this means
someone has generated a font that uses those names - as you confirmed.
Probably a programmatic conversion of some other font format.

This is not a very helpful font (e.g. in a PDF file, text extraction
will be likely impossible), but is often found. Purchased or built in
type 1 fonts will usually use StandardEncoding or ISOLatin1Encoding,
but each needs to be checked.

The processing goes character number - name from encoding - find glyph
in font with that name - show glyph.

(Multibyte fonts such as those used for OpenType will usually use
numbered characters instead).

Aandi Inston
Known Participant
July 29, 2008
I'm here for 2 weeks and I can't see why ... maybe the application is platform independent ... .

Anyway I am stuck in one point ...

How can I create the Encoding array?...

I mean I have the font bits ... and now I have to write in the file the encoding array ... but I can't see clear what do I have to do.

I saw an example that looks like this:


/Encoding 256 array
dup 0 /c00 put
dup 1 /c01 put
dup 2 /c02 put
...
%and then the CharString:
/CharStrings 257 dict dup begin
/.notdef 0 def
/c00 0 def
/c01 1 def
/c02 2 def


the /c00,/c01 have only the role to make the mapping between the Encoding array and CharStrings, right?

And also, for a known font type I saw an example like this:

I know this are rather simple questions ... but things are starting to
become really overwhelming over here ...

Is it something I'm missing here?because I thought that in de Encode array i will map every character with the new value .Is this why in the example it first defined /cxx and then used it in the CharString .

David.
Known Participant
July 28, 2008
I have a fundamental problem.
Where can I find a list with type1 fonts and truetype fonts ...
I mean I have a font name and when I want to assign it to something, I don't really know what to do ...

I am assuming that there are some config files in the OS, no(that is already done).

But if I want to display a text using Verdana, for example.

What type would I assing to it?

TrueType, Type1 ,3 ?
Is there something I don't get about this font types(from this point of view)?

David.
Participating Frequently
July 28, 2008
>But if I want to display a text using Verdana, for example.

Verdana is an OpenType font. So far I've stayed well clear of this.
>
>What type would I assing to it?

It isn't any of those types. You'd need to read the OpenType
specification and convert it. (Yes, another specification. This is
enough to keep you in work for several years).

>Is there something I don't get about this font types(from this point of view)?

I think the only thing you don't get is that you really have to do all
this. You are looking for shortcuts to avoid thousands of lines of
code.

Aandi Inston
Participating Frequently
July 28, 2008
David,
Transformation matrices are a bit tricky business. E.g. a matrix that does rotation in 2D
may have different forms, depending upon whether you use row vectors (as in PS) or
column vectors (as in Math), and whether you are rotating points or coordinate systems.

So whatever is said to PS transformation of points, may not be exact for lots of other cases.
Imagine a Cartesian coordinate system. In Math you use the "i" unit vector with coordinates
(1 0), and the "j" coordinate vector with coordinates (0 1).
Now you wish to describe a coordinate transformation, where the i and j "direction vectors"
will become i' and j'.

In the PS transformation matrix the first two elements are the coordinates of i', the next two are the coordinates of j', the last two describe an x-y translation.

In your case the first two elements are (1 0), that is there is no change in the x direction.
The next two are (0 -1), that is the new y goes downwards. That's mirroring.
The last two elements show no translation in x direction, but in y direction there is an upward lift of pageHeight.

Now you know how to correct your matrix, and you can construct other matrices for rotation, for skew, etc.

Miklos
Known Participant
July 28, 2008
And another simple problem ...

I am using a transformation matrix :

[1 0 0 -1 0 pageHeight]

before drawing the text, and the text is being displayed wrong (180 degrees)
What kind of transformation do I need for this?

David.
Known Participant
July 28, 2008
Before getting to that I see tat postscript has a lot of built-in fonts.
I see that PDF's can have the following :

Courier, Courier-Bold, Courier-Oblique, Courier-BoldOblique
Helvetica, Helvetica-Bold, Helvetica-Oblique, Helvetica-BoldOblique
Times-Roman, Times-Bold, Times-Italic, Times-BoldItalic
Symbol
ZapfDingbats

But I found and tested a lot more in PostScript (Chicago,Carta, JoahannaMT, etc)

are they recognized by every printer so I don't have problems?
or some of them I will have to define(if yes ... which)?

David.
Participating Frequently
July 28, 2008
>But I found and tested a lot more in PostScript (Chicago,Carta, JoahannaMT, etc)>
>are they recognized by every printer so I don't have problems?

Recognised, yes. Included, no.

Each printer has a some built in fonts. If you are writing a GENERAL
printer driver you should be using PPD files, which will tell you the
fonts in the printer.

>or some of them I will have to define(if yes ... which)?

The ones not in the printer.

Now, PostScript fonts in Windows come in "PFB" format. This is almost
direct PostScript, but not quite. If you can convert them to "PFA"
format, which is fairly trivial, then they become a valid fragment of
PostScript. This fragment does everything for the font, and concludes
with a "definefont".

If you are prepared to limit yourself to type 1 fonts, the project
shrinks enormously in scale. (And is compatible with all models.)

Aandi Inston
Known Participant
July 28, 2008
So, to get this straight I have to find the font format files and after that I have to read the documentation (which I didn't find btw) and extract the neccessary info from there ... is this wright ?

And another thing the font bytes for postscrip are the same like the ones for pdf(because I already have a method that returns me the font bytes, and I was wondering if is there something different)?

David
Participating Frequently
July 28, 2008
>So, to get this straight I have to find the font format files and after that I have to read the documentation (which I didn't find btw) and extract the neccessary info from there ...

Yes. You have a very large project on your hands.

With PostScript many people find things start easily but there are
sudden leaps where things become an order of magnitude more
complicated. Embedding your own platform fonts is one of these.

At least (if your printer is up to date) you have type 42 fonts so you
can just include the font tables. With older printers it is necessary
to do a dynamic conversion to type 1 font format, which means parsing
the drawing instructions of every character.
>
>And another thing the font bytes for postscrip are the same like the ones for pdf

There is similarity and overlap. Many of the base technologies are the
same. You need to read both specifications in great detail to see the
differences.

Aandi Inston