Skip to main content
Participant
August 11, 2011
Question

Add bold to a character definition

  • August 11, 2011
  • 3 replies
  • 1190 views

We have a definition of an upstanding arrow. We need to make it print bold. Is there an instruction to add to this definition that will give us a darker arrow, please?

/BRab {

BRpts

/BRsymbol findfont BRptsize scalefont setfont

(\014) Space

BRfont setfont

} bind def

Or are we stuck with the weight of the original character? I hope hope of a positive reply because there is a PostScript instruction to slant a character, e.g. to slant one by 17 degrees, you include in the definition 0.3057 mul (which apparently represents tan 176). (I really getting beyond what I know here!)

This topic has been closed for replies.

3 replies

Mr__Horton
Inspiring
August 16, 2011

Regarding the slanting of characters:

By using the makefont operator you can alter the font matrix to anamorphically scale or slant characters in a font without altering the current transformation matrix for everything else.

/Courier findfont               % gets the font Courier

[12 0 3.22 12 0 0]               % The first value sets the x scale to 12 (point size) and the fourth value sets the y scale to 12 as well.

                                        % The third value controls the slanting of the characters - in this case 3.22 = y scale (12) times the tangent of 15 degrees.

makefont setfont               % makefont applies the matrix to the found font and setfont makes it the current font

(Slanted Characters) show     %The show operator paints the string of "slanted" characters on the page.

Lyulph1Author
Participant
August 16, 2011

Many thanks, Mr. Horton, for your 3 messages. I've worked on the first but without success (except for getting some widened characters but not the arrow). I will work some more. I've happily just found our office copy of Adobe's PostScript Language Reference Manual, 2nd edition (1990), which may speed up things, too.

Mr__Horton
Inspiring
August 16, 2011

Example of stroking the character path:

(\014) is the arrow character in your symbol font - \014 is the octal encoding for the character

Space is a named procedure that probably adds a space after the character and "show"'s the character on the page - Posting the /Space definition would be helpful.

...

(\014) gsave dup      %saves the current graphics state and then duplicates the arrow character on the operand stack

false charpath      %gets the path (outline) of the arrow character.

1 setlinewidth 1 setlinecap 1 setlinejoin 1 setmiterlimit [] 0 setdash      %sets up the drawing properties for stroking the path (outline) of the arrow.

stroke grestore     % strokes (paints) the path (outline) of the arrow and the restores the graphics state to the way it was before setting up the stroking.

Space

...

% you can alter the setlinewidth value (1) to change the width of the line - remember the line is drawn on the center of the path.

% 1 setlinecap sets the line cap to round. 0=butt, 2=projecting square

% 1 setlinejoin sets the line join to round. 0=miter, 2=bevel

% [] 0 setdash sets the dash to a solid line (turns off any pre-existing dash pattern)

% 1 setmiterlimit is included because if you change to a miter line join, you may need to adjust this value depending on how acute the angles are in the arrow.

If you need an example of the other method I mentioned then let me know.

Of course, all this assumes that you can't just pick another font or character in the current font that has an arrow that is already bolder.

Mr__Horton
Inspiring
August 11, 2011

You can use the path of the arrow and stroke it with the current color at whatever additional linewidth you want and for an arrow, this might not look too bad.

You could also increase the size and adjust the baseline for the character, or increase the scale horizontally but not vertically and leave the baseline alone, to give it a bolder look.

Which method would work better for your application?