コード例 #1
0
ファイル: ps.php プロジェクト: abbeet/server39
        }
        begin_example_box($ps, LEFT_BORDER + (EXAMPLE_BOX_WIDTH + 30) * $x++, $y, "Text in a box (2)", $psfont);
        ps_setfont($ps, $psfont, 8.0);
        ps_set_value($ps, "leading", 11);
        $str2 = "Text can be put into a box of any size. This one is 80x80 pixels and its lower left corner ist at (10, 10). The text is left and right justified. The font size is 8.0.";
        ps_show_boxed($ps, $str2, 10, 10, 80, 80, "justify", NULL);
        end_example_box($ps);
    }
    if (isset($_REQUEST['box16']) && $_REQUEST['box16'] == "true") {
        if ($x > 3) {
            $y -= 150;
            $x = 0;
        }
        begin_example_box($ps, LEFT_BORDER + (EXAMPLE_BOX_WIDTH + 30) * $x++, $y, "Text with CR", $psfont);
        ps_setfont($ps, $psfont, 8.0);
        ps_set_value($ps, "leading", 11);
        ps_set_parameter($ps, "linebreak", "true");
        $str4 = "If the parameter linebreak is turned on\neach line will be ended with a carriage return.\nCR are marked with a '\\n' in this paragraph.";
        ps_show_boxed($ps, $str4, 10, 10, 80, 80, "center", NULL);
        ps_set_parameter($ps, "linebreak", "false");
        end_example_box($ps);
    }
    ps_end_page($ps);
    ps_close($ps);
    ps_delete($ps);
}
for ($x = 1; $x <= 16; $x++) {
    $checked[$x] = "";
}
foreach ($_GET as $key => $value) {
    list($nothing, $number) = split('box', $key);
コード例 #2
0
ファイル: fontsample.php プロジェクト: promoso/HVAC
            ps_stroke($ps);
        }
    }
    /* The name of the symbol */
    ps_setfont($ps, $psfont, 3);
    for ($j = 0; $j < 16; $j++) {
        for ($i = 0; $i < 16; $i++) {
            $text = ps_symbol_name($ps, $j * 16 + $i, $samplefont);
            ps_set_value($ps, "textx", $leftmargin + $i * $colwidth + 2);
            ps_set_value($ps, "texty", $bottommargin + (15 - $j) * $rowheight + 2);
            ps_show($ps, $text);
            $text = sprintf(" (%d)", $j * 16 + $i);
            ps_show($ps, $text);
        }
    }
    $text = "This fontsample matrix is created with the ps_symbol() function. It prints a glyph by its decimal value in the font encoding vector. pslib can use the TeXBase1 encoding (default) or the encoding shipped with the font itself, which is usually AdobeStandardEncoding. The above matrix uses the encoding of the font which is used when the parameter 'encoding' of ps_findfont() is set to 'builtin'. This usually results in a subset of all available glyphs of the font.\n\nQuite a lot of glyphs cannot be reached without the ps_symbol() function. The reason is simple: If text is output with ps_show(), then each character will be first mapped to a glyph by applying the ISO-8859-1 input encoding on it. Since ISO-8859-1 has less characters then a font usually provides glyphs, there will be some glyphs not reachable with regular text.";
    ps_setfont($ps, $psfont, 8);
    ps_set_value($ps, "leading", 12.0);
    ps_set_value($ps, "parindent", 12.0);
    ps_show_boxed($ps, $text, $leftmargin, $bottommargin - 250, $colwidth * 7.5, 230, "fulljustify", NULL);
    ps_setfont($ps, $samplefont, 8);
    ps_set_value($ps, "leading", 12.0);
    ps_set_value($ps, "parindent", 12.0);
    ps_show_boxed($ps, $text, $leftmargin + $colwidth * 8.5, $bottommargin - 250, $colwidth * 7.5, 230, "fulljustify", NULL);
    ps_end_page($ps);
}
ps_close($ps);
ps_delete($ps);
?>

コード例 #3
0
ファイル: glyphlist.php プロジェクト: promoso/HVAC
            for ($j = 0; $j < 16; $j++) {
                for ($i = 0; $i < 16; $i++) {
                    if ($glc + ($j * 16 + $i) < $listlen) {
                        $textwidth = ps_glyph_width($ps, $glyphlist[$glc + ($j * 16 + $i)], 0, $fontsamplesize);
                        ps_set_value($ps, "textx", $leftmargin + $i * $colwidth + $colwidth / 2 - $textwidth / 2);
                        ps_set_value($ps, "texty", $bottommargin + (15 - $j) * $rowheight + $rowheight / 2 + 3 - $fontsize / 2);
                        ps_glyph_show($ps, $glyphlist[$glc + ($j * 16 + $i)]);
                        ps_moveto($ps, $leftmargin + $i * $colwidth + $colwidth / 2 - $textwidth / 2, $bottommargin + (15 - $j) * $rowheight + $rowheight / 2 + 3 - $fontsize / 2);
                        ps_lineto($ps, $leftmargin + $i * $colwidth + $colwidth / 2 + $textwidth / 2, $bottommargin + (15 - $j) * $rowheight + $rowheight / 2 + 3 - $fontsize / 2);
                        ps_stroke($ps);
                    }
                }
            }
            /* The name of the symbol */
            ps_setfont($ps, $psfont, 3);
            for ($j = 0; $j < 16; $j++) {
                for ($i = 0; $i < 16; $i++) {
                    if ($glc + ($j * 16 + $i) < $listlen) {
                        ps_set_value($ps, "textx", $leftmargin + $i * $colwidth + 2);
                        ps_set_value($ps, "texty", $bottommargin + (15 - $j) * $rowheight + 2);
                        ps_show($ps, $glyphlist[$glc + ($j * 16 + $i)]);
                    }
                }
            }
            ps_end_page($ps);
            $glc += 256;
        }
    }
}
ps_close($ps);
ps_delete($ps);
コード例 #4
0
ファイル: text.php プロジェクト: promoso/HVAC
ps_set_value($ps, "charspacing", 0.0);
ps_show_xy($ps, "Some text which will be continued ...", 100, 400);
ps_continue_text($ps, "... in the next line ...");
ps_set_value($ps, "leading", 30);
ps_continue_text($ps, "... and another one with leading set to 30.");
ps_setcolor($ps, "both", "rgb", 1.0, 0.0, 0.0, 0.0);
ps_show_xy($ps, "Text can be written in color.", 100, 340);
ps_end_page($ps);
ps_begin_page($ps, 596, 842);
ps_setfont($ps, $font, 14.0);
ps_set_value($ps, "leading", 16);
ps_show_boxed($ps, "Text can be put into a box. It will automatically line wrapped. The text can left or right justified or centered. The given coordinates specify the lower left corner.", 100, 550, 100, 200, "left");
ps_show_boxed($ps, "Text can be put into a box. It will automatically line wrapped. The text can left or right justified or centered. The given coordinates specify the lower left corner.", 235, 550, 100, 200, "center");
ps_show_boxed($ps, "Text can be put into a box. It will automatically line wrapped. The text can left or right justified or centered. The given coordinates specify the lower left corner.", 370, 550, 100, 200, "right");
ps_set_value($ps, "leading", 30);
$text = "The line spacing (leading) can be set as on page 1. If the text does not fit into the box, it will be cut off. The string length of the remaining text is returned. This makes it quite easy to continue the remaining text in a second, third, fourth etc. box.";
$len = ps_show_boxed($ps, $text, 100, 320, 100, 200, "justify");
$len = ps_show_boxed($ps, substr($text, strlen($text) - $len), 235, 320, 100, 200, "justify");
$len = ps_show_boxed($ps, substr($text, strlen($text) - $len), 370, 320, 100, 200, "justify");
ps_set_value($ps, "leading", 20);
ps_set_parameter($ps, "hyphenation", "true");
ps_set_parameter($ps, "hyphendict", "D:/xampp/htdocs/xampp/external/ps/hyph_en.dic");
ps_set_value($ps, "hyphenminchars", 2);
$text = "You wonder if hyphenation is supported? Yes, of course and it uses the hyphenation files from scribus. Scribus provides hyphenation dictionaries for 14 languages. Another nice feature is Protution. This means that certain characters reach over the left or right margin. This is very useful for hyphens or punctuation to make straight looking margins like the one in the first column (it is very exaggerated).";
ps_set_parameter($ps, "RightMarginKerning", "hyphen=1000");
$len = ps_show_boxed($ps, $text, 100, 90, 100, 200, "justify");
$len = ps_show_boxed($ps, substr($text, strlen($text) - $len), 235, 90, 100, 200, "right");
$len = ps_show_boxed($ps, substr($text, strlen($text) - $len), 370, 90, 100, 200, "left");
ps_end_page($ps);
ps_close($ps);
ps_delete($ps);
コード例 #5
0
ファイル: hyperlinks.php プロジェクト: promoso/HVAC
$ps = ps_new();
if (!ps_open_file($ps, "hyperlinks.ps")) {
    print "Cannot open PostScript file\n";
    exit;
}
ps_set_parameter($ps, "warning", "true");
ps_set_info($ps, "Creator", "hyperlinks.php");
ps_set_info($ps, "Author", "Uwe Steinmann");
ps_set_info($ps, "Title", "Creating Hyperlinks with pdfmarks");
$fontsize = 20.0;
ps_begin_page($ps, 596, 842);
$b1 = ps_add_bookmark($ps, "Content", 0, 0);
ps_add_bookmark($ps, "First Page", $b1, 0);
$psfont = ps_findfont($ps, "Helvetica", "", 0);
ps_setfont($ps, $psfont, $fontsize);
ps_set_value($ps, "leading", 14.0);
ps_show_xy($ps, "This is a web link", 100, 100);
$len = ps_stringwidth($ps, "This is a web link", $psfont, $fontsize);
ps_add_weblink($ps, 100, 100, 100 + $len, 130, "http://www.mmk-hagen.de");
ps_show_xy($ps, "This is a pdf link to an external document", 100, 150);
$len = ps_stringwidth($ps, "This is a pdf link to an external document", $psfont, $fontsize);
ps_add_pdflink($ps, 100, 150, 100 + $len, 180, "test.pdf", 1, "fitpage");
ps_show_xy($ps, "This is a launch link", 100, 200);
$len = ps_stringwidth($ps, "This is a launch link", $psfont, $fontsize);
ps_add_launchlink($ps, 100, 200, 100 + $len, 230, "/usr/bin/gedit");
ps_show_xy($ps, "This is a pdf link within the document", 100, 250);
$len = ps_stringwidth($ps, "This is a pdf link within the document", $psfont, $fontsize);
ps_add_locallink($ps, 100, 250, 100 + $len, 280, 2, "fitpage");
ps_end_page($ps);
ps_begin_page($ps, 300, 300);
ps_add_bookmark($ps, "Second Page", $b1, 0);
コード例 #6
0
ファイル: psclock.php プロジェクト: promoso/HVAC
$radius = 200;
$margin = 20;
$pagecount = 300;
$ps = ps_new();
if (!ps_open_file($ps, "psclock.ps")) {
    print "Cannot open PostScript file\n";
    exit;
}
ps_set_parameter($ps, "warning", "true");
ps_set_info($ps, "Creator", "psclock.php");
ps_set_info($ps, "Author", "Uwe Steinmann");
ps_set_info($ps, "Title", "Analog Clock");
while ($pagecount-- > 0) {
    ps_begin_page($ps, 2 * ($radius + $margin), 2 * ($radius + $margin));
    ps_set_parameter($ps, "transition", "wipe");
    ps_set_value($ps, "duration", 0.5);
    ps_translate($ps, $radius + $margin, $radius + $margin);
    ps_save($ps);
    ps_setcolor($ps, "both", "rgb", 0.0, 0.0, 1.0, 0.0);
    /* minute strokes */
    ps_setlinewidth($ps, 2.0);
    for ($alpha = 0; $alpha < 360; $alpha += 6) {
        ps_rotate($ps, 6.0);
        ps_moveto($ps, $radius, 0.0);
        ps_lineto($ps, $radius - $margin / 3, 0.0);
        ps_stroke($ps);
    }
    ps_restore($ps);
    ps_save($ps);
    /* 5 minute strokes */
    ps_setlinewidth($ps, 3.0);