Beispiel #1
0
if (!empty($test_debug)) {
    echo "3. font={$font}\n";
}
# 4. Set font path to local variant, then specify font name with extension.
$p = new PHPlot_test();
$p->SetTTFPath(getcwd() . DIRECTORY_SEPARATOR . 'images');
$p->SetDefaultTTFont(TEST_FONT);
$font = $p->test_GetDefaultTTFont();
expect_match('[a-z]\\.ttf$', $font, 'Case 4. Set local font dir, then font name', $error);
if (!empty($test_debug)) {
    echo "4. font={$font}\n";
}
# 5. SetFontTTF with path and extension
$font_with_path_and_ext = $phplot_test_ttfdir . $phplot_test_ttfonts['serif'];
$p = new PHPlot_test();
$p->SetFontTTF('title', $font_with_path_and_ext, 12);
$font = $p->fonts['title']['font'];
expect_match('[a-z]\\.ttf$', $font, 'Case 5. Set title font with path and extension', $error);
if (!empty($test_debug)) {
    echo "5. font={$font}\n";
}
# 6. SetFontTTF with path and no extension - expected to fail.
$pp = pathinfo($phplot_test_ttfonts['serif']);
$font_with_path_no_ext = $phplot_test_ttfdir . basename($phplot_test_ttfonts['serif'], '.ttf');
// Note this uses the PHPlot_test2() class which suppresses the error image
// and allows the messages to be completely off.
$p = new PHPlot_test2();
$p->hide_error = True;
// Disables error message from PHPlot_test2
if ($p->SetFontTTF('title', $font_with_path_no_ext, 12)) {
    $font = $p->fonts['title']['font'];