Article View: comp.lang.postscript
Article #1576Re: Reverse video font?
From: Paul Stath
Date: Fri, 19 Jan 1990 19:48
Date: Fri, 19 Jan 1990 19:48
54 lines
2941 bytes
2941 bytes
hougland@osiris.cso.uiuc.edu writes:
>I am interested in printing characters in a 'reverse video' format, that
>is white characters on a dark background. I am afraid I may have to
>create my own font to do this, but can find no other way so far. Any
>suggestions would be welcome.
Why not just dup the string on the stack, and use the first instance to
get the bounding box of the string. Then use this to draw a filled rectangle
in the background color, then print the remaining string in white over the
filled bounding box?
Something along this line:
% Rvideo - expects the string to display in "reverse video" to be on
% the top of the stack. You must have a currentpoint
/Rvideo {
gsave
dup % Make two copies of the string on the stack
0 setgray % Set background video color
currentpoint % Save current point on stack
false charpath flattenpath pathbbox % get Bounding box of string
newpath % Start newpath
0 exch rlineto % line to UL-hand corner of bounding box
0 rlineto % line to UR-hand corner of bounding box
0 exch rlineto % line to LR-hand corner of bounding box
closepath fill % close path and fill with background color
moveto % Move to point saved with currentpoint
1 setgray % Switch to "reverse" video color
show % Show string
grestore
} def
Disclaimer: This is untested code written off the top of my head.
I don't claim that this would even come CLOSE to working "as is."
The good thing about this is that it will work with ANY font.
The problem is that the bounding box may only be as big as the
edges of the text. If this is the case, you could try adding
distance to the x and y coordinate placed on the stack by pathbbox,
or you could try changing the scale slightly after getting the
x/y corners of the bounding box. This could be a handy tool to
have in my PostScript toolkit, so if you get it working, send me
a copy. And since this is a followup instead of E-mail, if anyone
else has a different or better idea, I would enjoy seeing it.
I will test this code this week-end and see it I can come up with
some corrected, tested code.
---- What I wouldn't give for a PostScript signature!!! ----
--
===============================================================================
Paul R. Stath The Computer Solution Co., Inc. Voice: 804-794-3491
------------------------------------------------+------------------------------
INTERNET: prs@tcsc3b2.tcsc.com | "There was no diety involved,
Technical Details
Message-ID:
<1990Jan19.194829.12906@tcsc3b2.tcsc.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!aplcen!wb3ffv!ka3ovk!tcsc3b2!prsReferences:
<37700001@osiris.cso.uiuc.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!aplcen!wb3ffv!ka3ovk!tcsc3b2!prs From: prs@tcsc3b2.tcsc.com (Paul Stath) Newsgroups: comp.lang.postscript Subject: Re: Reverse video font? Message-ID: <1990Jan19.194829.12906@tcsc3b2.tcsc.com> Date: 19 Jan 90 19:48:29 GMT References: <37700001@osiris.cso.uiuc.edu> Organization: The Computer Solution Company, Inc. Lines: 54