Пример #1
0
if (!empty($test_debug)) {
    echo "2. font={$font}\n";
}
# 3. Set path only without font.
$p = new PHPlot_test();
$p->SetTTFPath($phplot_test_ttfdir);
$font = $p->test_GetDefaultTTFont();
expect_match('[a-z]\\.ttf$', $font, 'Case 3. SetTTFPath to dir, then get default', $error);
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']);