Skip to main content
Known Participant
July 22, 2008
Question

stroke and fill

  • July 22, 2008
  • 45 replies
  • 10642 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
August 5, 2008
When I want to display the glyphs, I use the keys defined in the encoding array?

David
Participating Frequently
August 5, 2008
>When I want to display the glyphs, I use the keys defined in the encoding array?

You use a string whose byte values are used as an index into the
encoding array.

Aandi Inston
Known Participant
August 4, 2008
The Type 42 Font Format Specification:
"The string should be subdivided into lines of a constant n characters in length and which may be divided by m characters of white space and/or
control characters."

:( ok so a TTF font I will have to take it from a .ttf file?

And I saw an example now that I can use different sfnts arrays for different things I want to write in the file.

Example : if I want to display "text" I use one smaller than one for
"abc ... z".

How can I do this, do I have to parse the ttf font file(how can I do this)?

PS:
If pfb files are used for type1, where should I embed the bytes ?

David.
Participating Frequently
August 4, 2008
>If pfb files are used for type1, where should I embed the bytes ?

You don't embed PFB files, you convert to PFA files and embed them.
You can embed the files anywhere before the font is used, unless you
want page independence or DSC conformance, which makes things more
complicated.

Aandi Inston
Known Participant
August 4, 2008
And last but not least, can I parse a font file so that I don't append overhead to the sfnts string .
I mean can I make it to append the glyph description only for a,b,c not for all the characters possible?
Participating Frequently
August 4, 2008
You can use incremental download of TrueType fonts if that is any use.
It requires much more detailed parsing of the TTF.

Aandi Inston
Known Participant
August 4, 2008
Another thing in the type 42 font format do I have to populate all 256 entries in the sfnts array .
In the Adobe standard fonts I was able to modify the Encoding array and worked fine.

I mean :

/Encoding 5 array
dup 0 /.notdef put
dup 1 /a put
dup 2 /b put
dup 3 /c put
readonly def
/CharStrings 5 dict dup begin
/.notdef 0 def
/a 1 def
/b 2 def
/c 3 def
end readonly def

and use it like this:
(\001) 100 100 moveto show

I still get a weird error in GSView:

---> Error: /rangecheck in show

David.
Known Participant
August 4, 2008
I seem to get blocked in simple stuff again, so I have to ask this:

When I download a TTF font, do I do this from a .pfb file? ...
Also, is there a rule for partitioning the string that I have to put in the ps file?
I mean I get that a string has a maximum of 65535 bytes, but is there a rule to choose m and n ... ?

I ask this becouse I get something like:


%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval--

...

--- Begin offending input ---
71a6e55c6d06d99eaff8193


--nostringval-- makes me think that is a problem with the sfnts ...
or this errors may have appeared because I didn't write the other stuff right?


David.
Participating Frequently
August 4, 2008
>When I download a TTF font, do I do this from a .pfb file? ...

No, there is no connection between a TTF font and a PFB file. A PFB
file contains a specially coded type 1 font.

>I mean I get that a string has a maximum of 65535 bytes, but is there a rule to choose m and n ... ?

I have no idea what you mean by m and n.

Aandi Inston
Known Participant
August 1, 2008
By that I mean :
Do I have to get another information, besides the snfts array from the .pfb file?

David.
Participating Frequently
August 3, 2008
Usually, a PFB is turned into a PFA file, then the whole thing is
valid PostScript.

Aandi Inston
Known Participant
August 1, 2008
Ok, I got it ...
Now I don't get something else :
1. If I have the binary .pfb file how do I decide the values of n and m for my hex encoding?

By that I mean does it matter how many bytes do I have on every line?
And how many strings would I need?

2.the CharString dictionary maps the names in the Encoding Array with the codes that we have in the font encoding?

David.
Participating Frequently
August 1, 2008
PS is a programming language, you may write a procedure that does the transformation and shows the label. Then you can use this in place of "show".
You can write another procedure that does not do the transformations just the rest.
This way the transformation stuff needs to be written only once.

I don't know what you may mean by "clip", in PS terms "clip" cuts-off unwanted things,
e.g. everything outside of a rectangle. If you meant just that, than I can't see what clipping
has to do with the need for transformations.

Miklos
Known Participant
July 31, 2008
:) That's what I did.
I thought it is something more complicated.

My problem was that I need to write the clip (from the Graphic state) every time I draw text, and I have to do a transformation before writing it, and in case I didn't had clip I would write the matrix for nothing and that would increase the size of the PS file.

Thaks!

David
Participating Frequently
July 31, 2008
The Current Transformation Matrix applies to everything. No CTMs for text.

If your text is upside-down, change the CTM before showing it, e.g. translate to its
beginning and use scale to change the direction of the y axis.

If you need the previous CTM still, use the gsave/grestore pair.

Miklos