Hello,
First of all let me thank you for the great library
This is my first experience with it and my question may seem a bit noobish for which I apologize
I m trying to output bulgarian text, but I constantly fail.
My DB and encoding is all UTF-8 (no BOM)
$myPicture->Render("../graphs_tmp/cache.png"); -> this will render the picture in the cache, but with no labels
#$myPicture->autoOutput("../graphs_tmp/poll.png"); -> This will output nothing in the browser
Works perfectly fine with ANSI encoding, but as soon as I switch to UTF-8 it fails
I tried ICONV and MB_STRING it from UTF-8 to ANSI (not sure it is even possible), but that did not work either
echoing the title and rendering the picture, will output proper text in the browser, but the rendered image will contain no labels.
I thought the specified FONT file did not support Bulgarian chars, but commenting it did not help. Then I tried the Tahoma ttf (supports BG for sure) and still nothing.
I m out of ideas guys. Help needed. Thanx in advance.
Code:
#echo $title;
$MyData = new pData();
$MyData->addPoints($answersNum,"Answers");
$MyData->setAxisName(0,"Answers (%)");
$MyData->addPoints($answers,"Options");
$MyData->setAbscissa("Options");
$myCache = new pCache();
$ChartHash = $myCache->getHash($MyData);
if ($myCache->isInCache($ChartHash)){
$myCache->saveFromCache($ChartHash,"../graphs_tmp/cache.png");
} else {
$myPicture = new pImage(500,220,$MyData);
$myPicture->setFontProperties(array("FontName"=>"Classes/pChart2/fonts/Forgotte.ttf","FontSize"=>15));
$myPicture->drawText(20,34,title,array("FontSize"=>20));
$myPicture->setFontProperties(array("FontName"=>"Classes/pChart2/fonts/pf_arma_five.ttf","FontSize"=>6));
$myPicture->setGraphArea(70,60,480,200);
$myPicture->drawGradientArea(70,60,480,200,DIRECTION_HORIZONTAL,array("StartR"=>200,"StartG"=>200,"StartB"=>200,"EndR"=>240,"EndG"=>240,"EndB"=>240,"Alpha"=>30));
$scaleSettings = array("DrawXLines"=>FALSE,"Mode"=>SCALE_MODE_START0,"GridR"=>0,"GridG"=>0,"GridB"=>0,"GridAlpha"=>10,"Pos"=>SCALE_POS_TOPBOTTOM);
$myPicture->drawScale($scaleSettings);
$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
$myPicture->drawBarChart(array("Rounded"=>TRUE,"Surrounding"=>30));
$myCache->writeToCache($ChartHash,$myPicture);
$myPicture->Render("../graphs_tmp/cache.png");
#$myPicture->autoOutput("../graphs_tmp/poll.png");
}