How to get the font name of ttf format file in PHP

autoload
Release: 2023-03-09 07:04:02
forward
2530 people have browsed it

TTF(TrueTypeFont) is a font file format jointly launched byAppleandMicrosoft. With the popularity of windows, it has become the most commonly used A font file format that is inevitably used in daily use.

 0) { $names[] = array ( 'platform' => $table[1], //平台(操作系统) 'language' => $table[3], //字体名称的语言 'encoding' => $table[2], //字体名称的编码 'name' => $fontname //字体名称 ); //break; } fseek($fp, $npos, SEEK_SET); } } } fclose($fp); } return $names; } ?>
Copy after login

Run result:

string(6) "SimHei" string(5) "SimHe" //貌似有UTF-16LE编码漏字的BUG string(6) "黑体"
Copy after login

Note: If you only need to get the font name, the above code can be improved as follows:

 0) { $names[] = array ( 'platform' => $table[1], //平台(操作系统) 'language' => $table[3], //字体名称的语言 'encoding' => $table[2], //字体名称的编码 'name' => $fontname //字体名称 ); //break; } fseek($fp, $npos, SEEK_SET); } } } fclose($fp); } return $names; } ?>
Copy after login

Recommended: "php video tutorial" "php tutorial"

The above is the detailed content of How to get the font name of ttf format file in PHP. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:西部数码
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!