5

我正在使用codeigniter * capctha * helper。问题是我不能增加字母的字体大小。我试图做到这一点

if ($use_font == FALSE)
{
    $font_size = 6;
    $x = rand(0, $img_width/($length/2));
    $y = 0;
}
else
{
    $font_size = 20;
    $x = rand(0, $img_width/($length/1.5));
    $y = $font_size+2;
}

但没有任何反应,如何更改字体大小,请帮忙。提前致谢。

4

2 回答 2

5

您正在更改正确的参数,无论是在核心文件还是应用程序/帮助文件中。

仔细检查您正在使用的字体。有些字体只有一种尺寸,就是这样。默认字体文件(texb.ttf)只有一种大小(?我认为......)。

我正在使用以下配置:

//----- Captcha Implementation -----
$this->load->helper('captcha');

$captchaSetup = array(
    'img_path'   => './captcha/',
    'img_url'    => base_url()."captcha/",
    'font_path'  => './assets/fonts/E004007T.TTF',
    'img_width'  => 250,
    'img_height' => 50,
    'expiration' => 7200
);

$capData['cap'] = create_captcha($captchaSetup);

选择一个字体文件并将其放在字体文件夹中并尝试一下。

于 2013-03-13T16:31:36.057 回答
0

您可以在 captha 中使用“true type”字体font_path来获得更大的尺寸。尝试设置path/to/your/ttfont.ttffont_path然后将更大的值传递给font_size. 它应该工作!

于 2016-06-30T17:34:52.720 回答