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


Groups > comp.lang.postscript > #723

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-10 00:15 +0200
Organization Decebal Computing
Message-ID <873964rv1p.fsf@Compaq.site> (permalink)
References <87r4to6ddr.fsf@Compaq.site> <878vfw66a3.fsf@Compaq.site> <fd5b6443-511b-49ae-91a7-3a1004854ccf@x39g2000yqx.googlegroups.com> <87bokss0jo.fsf@Compaq.site> <bfa2675b-f4b2-44e0-b80b-c498af3a3eb1@h9g2000yqi.googlegroups.com>

Show all headers | View raw


Op zaterdag 9 jun 2012 23:16 CEST schreef luser:

> On Jun 9, 3:16 pm, Cecil Westerhof <Ce...@decebal.nl> wrote:
>> 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-fil...
>>
>> The problem is that epstopdf makes the run illegal. Maybe I should use
>> bash to do the include myself.
>
> I forgot there was so much info on that page. My link goes straight
> to
> my answer. In the last comment to my answer, there's this:
>
> ==
> Also wanted to say thanks for the psinc tip, @luserdroog - that
> finally helped me cook a solution that works for me, using the command
> line and evince (added as separate answer); however, the regex in the
> original script didn't work with indented runs as in your example, so
> I made a mod: psinc.pl. Many thanks again for the answers - cheers!
> == http://sdaaubckp.svn.sourceforge.net/viewvc/sdaaubckp/single-scripts/psinc.pl
>
> This script will do what you propose to do with bash, in-lining
> all '(...) run' commands (may now be indented, but don't put other
> stuff on the same line).

I already made the script. Does a few things more:
  - only includes from the include directory
  - creates the png also

Included it at the end of the script. Now my postscript program takes
less as half the room and more importantly it fits on my screen. :-D


>>>>     % 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.
>
> That's good: DRY principle.

DRY is also why I wanted to work with a library.


> But better to make names with "*font" yield a font object.
> For sizes, call it "*fontsize" or "*fsz" or sthg.

I will take it into account.


>> Also what are good fonts to use? And in which situation?
>
> Well, my rule of thumb is to use Palatino unless you have a reason not
> to.
> But Bookman's good, too. It's still Zapf, I think. Also, stick with
> Zapf
> unless you have a reason not to.

Why stick with Zapf?


>>     /colorViolet {
>>       .9375 .5 .9375
>>     } def
>>
>>     /colorWhite {
>>      1 1 1
>>     }
>
> Missed a 'def'. For lots of little defs like this,

Oops.


> I'd wrap it in a dict:
>
> /colors <<
> /colorViolet { .9375 .5 .9375 }
> /colorWhite { 1 1 1 }
>>> def
> colors begin

Looks nice. I will try it out.


The bash script:
    #!/bin/bash

    set -o errexit
    set -o nounset

    declare -r INCLUDE_PATH=${HOME}/postscript/include
    declare -r OLD_IFS=${IFS}
    declare -r SCRIPTNAME=$(basename ${0})
    declare    INPUT_FILE
    declare    LOG_FILE
    declare    PDF_FILE
    declare    PNG_FILE
    declare    TMP_FILE

    declare include
    declare line
    declare temp

    if [[ ${#} -ne 1 ]] ; then
      echo "ERROR: ${SCRIPTNAME} FILE_NAME"
      exit 1
    fi
    if [[ ${1:(-4)} != .eps ]] ; then
      echo "ERROR: file should end with eps"
      exit 1
    fi

    INPUT_FILE=${1}; shift
    LOG_FILE=${INPUT_FILE}.log
    TMP_FILE=${INPUT_FILE}.tmp
    temp=${INPUT_FILE::(-4)}
    PDF_FILE=${temp}.pdf
    PNG_FILE=${temp}.png
    readonly INPUT_FILE
    readonly LOG_FILE
    readonly PDF_FILE
    readonly PNG_FILE
    readonly TMP_FILE

    rm -f ${TMP_FILE}
    rm -f ${LOG_FILE}
    IFS=$'\n'
    while read -r line ; do
      if [[ ${line::1} == '#' ]] ; then
        include=${line:1}
        if grep '^[-0-9a-zA-Z]*$' <<<${include} >/dev/null ; then
          cat ${INCLUDE_PATH}/${include} >>${TMP_FILE}
        else
          echo "ERROR: used an illegal include (${include})"
          exit 1
        fi
      else
        echo ${line} >>${TMP_FILE}
      fi
    done <${INPUT_FILE}
    IFS=${OLD_IFS}
    epstopdf ${TMP_FILE} --outfile=${PDF_FILE} 2>>${LOG_FILE}
    convert ${PDF_FILE} ${PNG_FILE}
    echo "${INPUT_FILE} converted"

-- 
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