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


Groups > comp.lang.postscript > #717

Re: Why do I not see the characters

From Cecil Westerhof <Cecil@decebal.nl>
Newsgroups comp.lang.postscript
Subject Re: Why do I not see the characters
Date 2012-06-09 22:16 +0200
Organization Decebal Computing
Message-ID <87bokss0jo.fsf@Compaq.site> (permalink)
References <87r4to6ddr.fsf@Compaq.site> <878vfw66a3.fsf@Compaq.site> <fd5b6443-511b-49ae-91a7-3a1004854ccf@x39g2000yqx.googlegroups.com>

Show all headers | View raw


Thanks for the input.

Op zaterdag 9 jun 2012 19:14 CEST schreef luser:

>>> I also started making a library. But I am working with epstopdf to
>>> make a pdf and then convert to create a png. Ideally I would not have
>>> to have the library in the program itself, but could use an include.
>>> But that is not possible with epstopdf. I tried to use the command
>>> that epstopdf generates without the -dSAFER, but to no avail. Anyone
>>> an idea how to solve this?
>
>
> There's some useful stuff on this page:
> http://stackoverflow.com/questions/9820646/overlay-two-postscript-files-command-line-approach/9833901#9833901

The problem is that epstopdf makes the run illegal. Maybe I should use
bash to do the include myself.


>>     %% Library functions
>>     /grayBackground { % gray
>>       newpath
>>       gsave
>>       setgray
>>       newpath
>>       pageLeft pageBottom pageRight pageTop rectangle
>>       fill
>>       stroke
>
> 'fill' just ate the path! 'stroke' has nothing to do.
> You can do 'gsave fill grestore stroke' if you really
> want to. Since you're not changing colors, it'll just
> make the box a little bigger. But it would give you
> the linejoin effect at the corners.

I did not know what I was doing. Changed. Now I need to do it in all
the others also. :-{


>>     % Library init
>>     /authorFont     10 def
>>     /backgroundGray .6 def
>>     /usedFont       /Bookman findfont def
>
> Your font handling is a little hard to follow.

In the first program I used several different font sizes. In this way
I need only to make a change at one place. But I will look into your
suggestions.

Also what are good fonts to use? And in which situation?


> It mostly looks good.

Thank you. ;-}


> But I'd recommend more indentation levels.
> Treat 'gsave' like '{' and 'grestore' like '}'. Sometimes I'll

In some places I did this, but I will do it more consequent.


> indent all 'lineto' and 'moveto's and come back out for the
> 'stroke', since they are all "functionally subordinate".

That could be a good idea also.

I also changed string to msg.

I used the program to write a logo program. It is given below. I only
have one problem. I now have a compleet rosetta. The letters in de
lower part have te be placed differently. I have a function
textheight, which does what it should in other places, but here it
does not. Because of the I now use textwidth. It is better as nothing,
but for example the m is not placed very good. What is going wrong
here?

The program:
    %!PS-Adobe-3.0 EPSF-3.0
    %%BoundingBox: 0 0 600 600

    /pageBottom  0 def
    /pageLeft    0 def
    /pageRight 600 def
    /pageTop   600 def

    %% Library functions
    /colorBlack {
      0 0 0
    }

    /colorBlue {
      0 0 1
    } def

    /colorGreen {
      0 .5 0
    } def

    /colorIndigo {
      .3125 0 .5
    } def

    /colorOrange {
      1 .5625 0
    } def

    /colorRed {
      1 0 0
    } def

    /colorViolet {
      .9375 .5 .9375
    } def

    /colorWhite {
     1 1 1
    }

    /colorYellow {
      1 1 0
    } def

    /grayBackground { % gray
      newpath
      gsave
        setgray
        newpath
        pageLeft pageBottom pageRight pageTop rectangle
        fill
        .4 setgray
        usedFont
        authorFont scalefont
        setfont
        ((c) Cecil Westerhof - Decebal Computing) 550 5 rightString
      grestore
    } def

    /rectangle { % left bottom right top
      4 dict begin
        /top    exch def
        /right  exch def
        /bottom exch def
        /left   exch def

        left  bottom moveto
        right bottom lineto
        right top    lineto
        left  top    lineto
        left  bottom lineto
        closepath
      end
    } def

    /rightString { % msg x y
      3 dict begin
        /y   exch def
        /x   exch def
        /msg exch def

        x y moveto
        msg stringwidth pop neg
        0
        rmoveto
        msg show
      end
    } def

    /textheight {
      gsave
        {
          newpath
          100 100 moveto
          (HÍpg) true charpath pathbbox      % gets text path bounding box (LLx LLy URx URy)
          exch pop 3 -1 roll pop             % keeps LLy and URy
          exch sub                           % URy - LLy
        }
        stopped                                % did the last block fail?
        {
          pop pop                            % get rid of "stopped" junk
          currentfont /FontMatrix get 3 get  % gets alternative text height
        }
        if
      grestore
    } def


    %% Normal functions
    /createWedgeValues {
      /steps    msg length def
      /turn     360 steps 2 mul div neg def
      /halfTurn turn 2 div def
    } def

    /wedge { % msg downward
      gsave
        newpath
        0 0 moveto
        1 0 translate
        halfTurn rotate
        0 halfTurn sin translate
        gsave
          0 0 halfTurn sin 90 -90 arc
          closepath
          gsave
            fill
          grestore
          0 setgray
          stroke
        grestore
        0 setgray
        dup
        {  90 rotate }
        { -90 rotate } ifelse
        exch
        dup
        stringwidth pop 2 div neg
        3 -1 roll
        { dup  moveto }
        { 0 moveto } ifelse
        show
      grestore
    } def

    % Library init
    /authorFont     10 def
    /backgroundGray .6 def
    /usedFont       /Bookman findfont def

    % Program init

    %backgroundGray grayBackground

    gsave
      300 300 translate
      0 0 moveto
      245 245 scale
      usedFont
      .25 scalefont
      setfont
      0.02 setlinewidth
      180 rotate
      colorBlue
      setrgbcolor
      /msg (Decebal) def
      createWedgeValues
      0 1 steps 1 sub {
        msg exch 1 getinterval
        false wedge
        turn rotate
      } for
      colorGreen
      setrgbcolor
      /msg (Computing) def
      createWedgeValues
      180 turn sub rotate
      0 1 steps 1 sub {
        msg exch 1 getinterval
        true wedge
        turn neg rotate
      } for
    grestore

    showpage

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

Back to comp.lang.postscript | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Why do I not see the characters Cecil Westerhof <Cecil@decebal.nl> - 2012-06-09 11:30 +0200
  Re: Why do I not see the characters Cecil Westerhof <Cecil@decebal.nl> - 2012-06-09 14:04 +0200
    Re: Why do I not see the characters John Deubert <john@acumentraining.com> - 2012-06-09 07:18 -0700
      Re: Why do I not see the characters Cecil Westerhof <Cecil@decebal.nl> - 2012-06-09 19:50 +0200
        Re: Why do I not see the characters Helge Blischke <h.blischke@acm.org> - 2012-06-09 22:24 +0200
    Re: Why do I not see the characters luser- -droog <mijoryx@yahoo.com> - 2012-06-09 10:14 -0700
      Re: Why do I not see the characters Cecil Westerhof <Cecil@decebal.nl> - 2012-06-09 22:16 +0200
        Re: Why do I not see the characters luser- -droog <mijoryx@yahoo.com> - 2012-06-09 14:16 -0700
          Re: Why do I not see the characters Cecil Westerhof <Cecil@decebal.nl> - 2012-06-10 00:15 +0200
            Re: Why do I not see the characters luser- -droog <mijoryx@yahoo.com> - 2012-06-09 15:51 -0700
    Re: Why do I not see the characters luser- -droog <mijoryx@yahoo.com> - 2012-06-09 10:24 -0700

csiph-web