CID-Keyed Fonts. Device Control. Using Page Devices.
lf43, SoftwareDevelopment: The PostScript Language
Page Device Parameters. In-RIP Trapping. Output Device Dictionary. Conversions among Device Color Spaces. Transfer Functions. Scan Conversion Details. Operator Summary. Operator Details. Appendix A. LanguageLevel Feature Summary. LanguageLevel 3 Features. LanguageLevel 2 Features. Appendix B. Implementation Limits.
Typical Limits. Virtual Memory Use. Appendix C.
Vim documentation: print
Interpreter Parameters. Properties of User and System Parameters. Defined User and System Parameters. Details of User and System Parameters. Device Parameters. Appendix D. Compatibility Strategies. The LanguageLevel Approach. When to Provide Compatibility. Compatibility Techniques.
Installing Emulations. Appendix E. Character Sets and Encoding Vectors. Times Family. Helvetica Family. Courier Family. Standard Latin Character Set. StandardEncoding Encoding Vector. CE Encoding Vector. Expert Character Set. Expert Encoding Vector.
Wide dashed lines in Postscript
ExpertSubset Encoding Vector. By default the types of images that we import or indeed export are inferred by their file extensions to make most conversions as simple as possible. This simple interface allows us to create supported input images for grImport and grImport2. For grImport , this was a task previously left as an exercise to the user, but is now much more convenient with the grConvert package. The convenience of converting between vector image formats in R reduces the time and effort needed to produce valid images for grImport or grImport2.
At this point in the technical report, we have demonstrated some of the capabilities of grImport2 , but have not yet shown how this is performed. There are only two steps necessary to draw images with grImport2 : reading, and drawing. Reading a picture is performed using the readPicture function. It expects a filename or remote location that points to an image that should be consumed to create a Picture object. This Picture contains all of the information necessary to reproduce the imported image in R. Once the image has been read in via readPicture , we can reproduce the image within R.
There are two high-level functions we can use to draw this Picture object. We will first examine grid. It takes a Picture object, and enables it to be drawn within any grid viewport. For example, we can draw it to the entire page. One problem that we can observe from the rendered image in Figure 7 is that the lines in the Union Jack are not clipped at all.
To correct this problem, grImport2 can clip to the bounding box of any clipping paths in the image. This is demonstrated in Figure 8. By clipping to the bounding box of any clipping paths, at least for this simple image, greatly improves the appearance of the flag. The rendering is not yet perfect, because the diagonal lines in the Union Jack are not clipped properly. However, we have reached the limitations of R graphics as it does not support this feature. This is illustrated in Figure 9. The use of clipping paths instead of clipping rectangles improves the appearance of our flag so that it now renders identically to the source image.
We have focused on clipping, but there are further graphical features that we can use. For example, the central features of the state flag of Kansas contains linear gradients. These are not shown at all without the use of gridSVG , instead they are drawn using the current fill colour. This means that the use of gridSVG is beneficial, and in cases like these, essential for accurate reproduction of imported graphics. The second high level function that grImport2 provides for working with Picture objects is called grid.
It is used for drawing several copies of of a picture at a set of x , y locations, with specified sizes. For statistical graphics purposes, the most obvious use for this function is to create custom plotting characters. To demonstrate how this may be used, we will use a custom panel function for the lattice package. The panel function will give us some x , y locations to plot at and will also give a random size for each of the pieces of the plot. Figure 11 shows that we have an easy way of using custom data symbols in grid plots if we use grid.
One drawback however is that grid. To draw multiple custom symbols will require multiple calls to grid. One of the things you may want to do is change the appearance of a picture once it has been imported. There are two ways to do this, but we will first discuss the most convenient method; the second will be discussed later in this technical report. The most convenient way to modify images imported by grImport2 is to change their graphical parameters, for example the colours that are being used within a flag.
Both the grid. This argument should be a function that takes a grid gpar object, and returns a modified version of that object. This is a much simpler approach than writing custom methods for Picture and related objects as is the case with grImport. Primarily this is because the task of creating graphics objects should be undertaken by grImport2 , but changing the graphical parameters of pictures should be configurable by the user. As we have established earlier, the way in which the graphical parameters can be modified is by the use of a function that takes a gpar object and returns a modified gpar object.
We will construct a function that desaturates all of the colours in a gpar object, and apply that to our flag of New Zealand. Figure 12 shows how the gpFUN argument can be used to modify the appearance of an imported image.
The PostScript Language
This can be accomplished by using scaling property of PostScript. The user can rescale of the horizontal and vertical units separately via the following command. This means that the case where these factors are equal to 1 creates no effect on the drawing. The effect of the scaling is maintained until the next scaling command is issued. The next issued scaling command does not remove the effect of the previous one but it combines its own effect with the previous one. This point must not be kept far from the eyes to avoid undesired results in the displays, such that some paths may slide out of the paper surface.
PostScript assumes the nonexistence of scaling by default. The following PostScript program which is assumed to be saved in the file sample4. As can be noticed, the scaling affects each size including the line width. The line widths of the ellipses and the circle created by the above program are different due to this reason. PostScript also has two other commands for arc drawing. One of them, arcn , is mainly same with arc except the drawing direction. The third arc drawing command draws a circular arc which is tangent to two given lines at the endpoints.
It can be issued as follows.
Ghostscript and the PostScript language
If the path is not new or the current point does not coincide with the beginning of the arc then a line joining the current point and the beginning point of the arc is added to the path. At the end of the drawing the currentpoint becomes xt2, yt2. PostScript has also a Bezier algorithm based command which can be effectively used in the interpolation or extrapolation of a given data for plotting.
This command is curveto and can be used to form the plots based on the interpolation or extrapolation of a given set of data. The command can be used as follows. It is tangent to the line between the points x0, y0 and x1, y1 at the beginning point. The curve ends at the point x3, y3 and is tangent to the line between x2, y2 and x3, y3. By default all these four points are assumed to be different and they determine the shape of the figure. PostScript has various fonts which are used as standard fonts for desk-top publishing. It has also font creating facilities which can be accessed by defining dictionary stacks where fonts are available.
The following PostScript program can be given as an example. As can be extracted from the program findfont command is used for getting an access to the desired font structure. When we get into the details of stack operations later this point will be more clear. After the selection of the command the scaling is defined through the scalefont command. The scaling factor is given as a preceding number to this command. After scaling of the font, the command setfont makes the font ready for future usage in the program.
After we locate the cursor through the moveto command with appropriate parameters, the text material encompassed by the parenthesis is given a parameter for the show command. The showpage command finalizes the displaying of the written material. The above program uses different fonts in type and size for the same text located at different positions. The number of the avaliable fonts for PostScript can be found by searching the locations of the fonts in the tree structure of the linux system you use.
The text can be adjusted through lines, curves and by some other tool. So any kind of writing, in principle, is possible.
It is just a matter of design. PostScript language is equipped with several facilities to paint figures or create colorful pictures. Let us start by mentioning the coloring commands first. PostScript uses black as the default color unless a color specification command is issued. Hence the output of the all previous programs were black and white pictures. To use color in the output PostScript can use three different coloring command. The first one is based on the rgb color format. In this format each color is assumed to be composed of three main colors: red, green and blue.
The color components can be given by individual intensity parameters which can take the values between 0 and The intensity parameters can accept the decimal fractional values up to three digit precision like Therefore the command expected by PostScript must be given as follows. In this convention 1 0 0 setrgbcolor creates red color while 0 1 0 setrgbcolor creating green.
Black corresponds to the case where all intensity parameters take the value of 1. Color setting command continues to affect every drawing and painting until the next color setting command is issued. When this happens the effect of the first setting is completely removed and the new setting dominates everything. The number of usage for the color setting is unlimited. By approriately using the color settings you can create your pictures just as you want. It is a matter of art and up to you. The second color setting facility is based on a four component color format.
This is called cmyk color format. The four basic color components are cyan, magenta, yellow and black respectively. Each color component contributes the final color according to an intensity parameter which can vary between 0 and 1. The corresponding PostScript command is therefore as follows. The fractional decimal values can also be used for intensity parameters. This command also continues its effect on everything until the next command is issued. When this is done the new setting overdominates the preceding setting.
There is no limitation on the number of usage for this command in a program. First one corresponds to hue which determines the location of the color in the spectrum of the light. The second one, saturation and the third one, brightness corresponds to the saturation and the brightness of the color. The most important PostScript command for painting is fill and closepath.