f



How do you generate an array of actual font names from your /fonts folder in PHP?

Consider my code:

[PHP]
	/**
	 * Set the TTF array property $ttfArray
	 *
	 * @access private
	 * @see actual_path
	 */
	function &setTTFArray() {					// STATIC VOID METHOD
		global $ttfPath;					// OBTAIN VAR FROM project_globals.inc.php
		if (is_dir($ttfPath)) {
		 $dirID = @opendir(actual_path($ttfPath));
		 while ($ttf = @readdir($dirID)) if
(@is_file(actual_path("$ttfPath/$ttf")) && preg_match('/\.ttf$/i',
$ttf)) @array_push($this->ttfArray, actual_path("$ttfPath/$ttf"));
		}
	}
[/PHP]

This will generate an array of TTF font names, however, the problem is
that it generates an array of TTF font FILE names, which is usually
utterly unreadable, at least unknowable, to the user.

How can I change it to be an array of the actual TTF font names and not
the literal TTF font FILE names?

The directory will be utterly dynamic as this is from a portable web
application.

Thanx
Phil

0
1/10/2007 7:16:23 AM
comp.lang.php 32646 articles. 0 followers. Post Follow

1 Replies
680 Views

Similar Articles

[PageSpeed] 45

comp.lang.php wrote:
> How can I change it to be an array of the actual TTF font names and
> not the literal TTF font FILE names?
>

When you are able to run Perl, the best thing you can do is to have a look 
at the Font::TTF::Name package, build a small perl script that uses its 
functionality and call the script from PHP through system/exec.

If you feel up to some extensive reading, here are the specs:

http://www.microsoft.com/typography/default.mspx


JW 


0
jw137 (829)
1/10/2007 2:20:22 PM
Reply:

Similar Artilces:

using font generator setvar(font groups, new font name)
I'm trying to determine if you have to create a font for each version and size of the font being used. Ie. Do I have to create seperate fonts for: Courier New, Bold, size 8 and Courier New, italics, size 8 or can I just create one for Courier New size 8 and it recognize it? Any help is much appreciated. Thank you. -Halina ...

Send array from php to php
HI every one I' try to send array from web page to php file but no data are show I'm using session to store data and this is my code //////////////////////////////////////////////////////////////////////// $data = $cart_items; session_register('data'); foreach ($cart_items as $cart_item) { echo "<tr>"; echo " <td><span class='style2'>".$cart_item->name."</span></td>"; echo " <td><span class='style2'>".$cart_item->description."</ span></td>"; echo " <td><span class='style2'>".$cart_item->price." S.R.</span></ td>"; echo " <td><span class='style2'>".$cart_item->quantity."</span></ td>"; echo " <td><span class='style2'>".$cart_item->price * $cart_item- >quantity."</span></td>"; echo " <td><span class='style4'><a href='order.php?action=del&id=". $cart_item->object_id."'>[del]</a></span></td>"; echo "</tr>"; \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \ and this is my php code to get the data //////////////////////////////////////////////////////// <?php foreach ($data as $item) { echo "<tr>"; print " &l...

About moving fonts from font folder to docs
Need some advice about moving fonts. I have far too many in my windows font folder, installed there before I knew any better. Is it of any benefit to me to move them out of there and into a folder in my documents? I use The Font Thing to install/uninstall/delete fonts. Have heard one too many times that I shouldn't have over 200 fonts in my fonts folder, and everyone tells me just to move them to a folder in docs, but if they are installed from there, does it make any difference (you can tell I know next to nothing about 'puters, eh?). Also, if it IS beneficial to move them out of there, is there a proper procedure to follow, for example, do I uninstall them before moving them and then reinstall them from their new location? Go easy, and slow, I ain't gifted :-p Thanks in advance to anyone who can advise me in this, my poor HD is really too full and I am hoping this will help ease its load a lil bit. ~Snayke "Snayke" <HissMa17@ns.sympatico.ca> wrote in message news:XatYd.18324$oh4.661884@ursa-nb00s0.nbnet.nb.ca... : Need some advice about moving fonts. I have far too many in my windows font : folder, installed there before I knew any better. Is it of any benefit to : me to move them out of there and into a folder in my documents? I use The : Font Thing to install/uninstall/delete fonts. Have heard one too many times : that I shouldn't have over 200 fonts in my fonts folder, and everyone tells : me just to mov...

Urgent problem with font sizes in latex: signature page fonts, chapter page chapter name font
Hi there, I am a newbie using Latex for writing my thesis. I have no clue how to change the .sty or .cls files as I am using others templates, (.sty files) directly on Winedt and editing them with my text. I use a document class: report.The chapter font size in the beginning page of each chapter has a large font size. Is there a way I can reduce this font size to12? Also in the table of contents page the dots dont extend to the page numbers for the chapters and main headings. Only subsections etc., have dots extending to page numbers. Any help on this? The Signature page shows up font sizes less than 10. Graduate school demands font sizes between 10 and 12 consistently. I will greatly appreciate any of your help with this as early as possible. Regards Krishna My main file:%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \documentclass[11pt]{report} \usepackage{amssymb,latexsym,amsmath} \usepackage[dvips]{graphicx} \usepackage{pst-node} \usepackage{thesis} \usepackage{lscape} \usepackage{supertabular} \graphicspath{{Figures-TestPage/}} % Sets the path of the graphics figures \begin{document} \thesistitle{DIAGNOSTICS OFIMAGE SATELLITE} \thesisauthor{Radha Krishna Proddaturi} \thesisdate{August 2007} \degrees{B.Tech.} \committeelines{\signline{} \vspace{0.2cm} \signline{} \vspace{0.2cm} \signline{Advisory Committee Chair} \vspace{0.2cm} \signline{Chair, Department of Electrical Engineering}} \deanlines{\signline{Dean, College of Engineering and Mines} \signline{Dean of the Graduate S...

If I have a TTF font file, what is its font name in Ghostscript?
I know that I can use a Fontmap file to map it, but I'd rather not.... On Thu, 18 Jan 2007, Ross Presser wrote: > I know that I can use a Fontmap file to map it, but I'd rather not.... What was the question? Oh, you wrote it only in the Subject and forgot to ask in the body of your posting. The PostScript name is stored in the 'name' table. http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6name.html In article <1169135234.543684.239990@q2g2000cwa.googlegroups.com>, "Ross Presser" <rpresser@gmail.com> wrote: > I know that I can use a Fontmap file to map it, but I'd rather not... Don't you need to put an entry in the Fontmap file anyway ? At any rate, I came across a similar problem a few GS release back (I wanted to populate the Fontmap with the proper name...) I simply associated the TTF file to a /Dummy fontname in Fontmap and then called 'findfont' for that dummy name. Recent versions of GS shows you a message that gives the expected PS name ("Using ThisFontPSName font for Dummy") This does not seem to work for large (?) fonts. For instance, the 6+ Megabytes "MS Gothic" found in MS Office 2004 Test Drive on my Mac errors out on GS 8.54 with a /rangecheck in --string--, having a 90000+ value on top of operand stack) Otherwise, parsing the TTF tables is another possibility. -- ________________________________________________________ Fran�ois Robert On 18 Jan 2007 07:47:1...

OT: Fonts in MS word are not in Fonts folder
I am looking for a fotn called univers, and it is listed in MS word itself, but it is not in the actual font folder on the system for windows. Anyone know where this mayb be located? tia Arthur What version of Word. I didn't see that one on my list. Word2000. Have you tried searching your HD for a file named "*univers*". "Arthur Y-S" <modelstoprintin3d@hotmail.com> wrote in message news:2gk3p2F3rro5U1@uni-berlin.de... > I am looking for a fotn called univers, and it is listed in MS word itself, > but it is not in the actual font folder on the system f...

Windows\Fonts folder bulging with OpenType fonts
I am trying to get my font management under control using Font Navigator. I've accumulated nearly 5000 fonts in folders on my computer. (A new Pentium 2.4 with 1GB RAM and Windows 2000 Pro - primarily using CorelDraw, PhotoShop and Word - if any of that matters.) Having read the tutorial The Last Word in Font Management (www.unleash.com/articles/fonts/fontmanage.html) and the help files on Font Navigator, I decided to clear out the Windows\Fonts folder as described. However there are over 180 OpenType fonts in the folder (which the tutorial suggests leaving alone). I understand that Font...

Find the font file name from fonts.dir?
I have: the XLFD such as -monospace-Arial-bold-.... I want: the font file name such as "arialbd.ttf" (for Arial bold) which I need for the PDFLib as to export PDF documents. I've noticed that both values are listed in the font directories in a file called fonts.dir (clever me ;). Now my question: does there exist some XLib API call which does that for me? XListFonts only returns me matching XLFDs, given a certain XLFD which is is not what I want. Or can anyone point me to some sample code which does this job (iterate over all directories in the font path as returne...

Font embedding problem: coded font names?
I've received a TeXShop-generated PDF file from a colleague in which many of the math symbols in the equations don't print or have obviously incorrect substitutions when I try to print it using Acrobat. I also get Acrobat warnings like "Unable to find font ABCXYZ+CMR10; Courier substituted". Converting the PDF file to a Postscript (.ps) file and examining this with a text editor shows that all of the dozen or so font names appearing in the file have been renamed from standard TeX names cmr10, cmmi10, etc., to the form "ABCXYZ+CMR10", etc, where "A...

Use PHP var in PHP generated Javascript?
I know the common way of using a PHP variable in javascript via: <script>myjsvar = <?echo $phpvar;?>;</script> But in my case I'm generating several javascript code blocks (which produce some flash) via a PHP loop, so I need to figure out another way to get the PHP vars into these blocks similar to: foreach ($lines as $line) { print "<script>myjsvar = $phpvar;</script>"; } I've tried various ways to get this working included ".$phpvar." and "+ $phpvar+", etc. None seem to work. There has to be a way to make this work. Any suggestions? Thanks, Max On Jan 1, 6:03=A0pm, Max <m...@kipness.com> wrote: > I know the common way of using a PHP variable in javascript via: > > <script>myjsvar =3D <?echo $phpvar;?>;</script> > > But in my case I'm generating several javascript code blocks (which > produce some flash) via a PHP loop, so I need to figure out another > way to get the PHP vars into these blocks similar to: > > foreach ($lines as $line) { > > =A0 =A0 =A0print "<script>myjsvar =3D $phpvar;</script>"; > > } > > I've tried various ways to get this working included ".$phpvar." and "+ > $phpvar+", etc. None seem to work. There has to be a way to make this > work. > > Any suggestions? > > Thanks, > Max Wouldn't print "<script>myjsvar =3D {$phpvar}...

PHP Training Institute In Delhi, Live Projects on PHP. Short Term PHP Courses, PHP Scripts, PHP Training with Live Projects.
Vserve Global offers short term PHP: Hypertext Preprocessor Training Course, which is a widely used, general-purpose scripting language that was originally designed for web development, to produce dynamic web pages. It can be embedded into HTML and generally runs on a web server, which needs to be configured to process PHP code and create web page content from it. It can be deployed on most web servers and on almost every operating system and platform free of charge.PHP is installed on over 20 million websites and 1 million web servers. TOPICS:- >> Core PHP Language >> HTML, Cascad...

Font recognition using PHP
Hi All, I have been assigned a project to develop a "font recognition application" using PHP. It goes something like this:- The user uploads an image file containing some text. The application is required to identify the text and the font used there. Below are links to 2 great applications which I would like to derive from:- http://www.myfonts.com/WhatTheFont/ http://www.imagaro.com/m2.html So far what I understand is, I'll need to have the font names along with their features to be stored in a database, then I'll need to analyze the image, pick up the characters from it, identify their typographical features and run a match on the database to get the top matching fonts. However right now I haven't got a clue as to how I go about the implementation of the above logic or whether there's some other approach. Need to start right from a scratch, any inputs/suggestions are greatly appreciated. Thanks in advance. eureka wrote: > However right now I haven't got a clue as to how I go about the > implementation of the above logic or whether there's some other > approach. The only valid approach is to use pattern recognition algorithms. Are you good at maths and statistics? -- ---------------------------------- Iván Sánchez Ortega -ivan-algarroba-sanchezortega-punto-es- Proudly running Debian Linux with 2.6.26-1-amd64 kernel, KDE 3.5.9, and PHP 5.2.6-5 generating this signature. Uptime: 21:02:54 up 74 days, 9:58, 4 use...

php outside php (?)
Sounds weird, i know. What i want/wonder is the following: PHP can do the next: <?php if($foo == 'bar') { ?> Ow yeah, foo is bar! <?php }; ?> But how can i do the following: <?php $foo= ?> this is what foo looks like. <?php }; ?> This way i could edit the content of $foo in DW's design-view. I hope it's clear enough for you all to understand... Greetings frizzle. frizzle wrote: > But how can i do the following: > > <?php > > $foo= > > ?> > this is what foo looks like. > <?php > > }; > > ?> > > This way i could edit the content of $foo in DW's design-view. > I hope it's clear enough for you all to understand... <?php ob_start(); ?> this is what foo looks like. <?php $foo=ob_get_clean(); ?> -- Justin Koivisto - justin@koivi.com http://koivi.com Wow, little late on the reply, but i still wanted to thank you for your help. This is exactly what i meant, and it works great! :D Thanks again. ...

font id: Anne Geddes' name font
hi, I'm looking for a freeware/share font similar to the one used by Anne Geddes to write her name at the bottom of her pictures. any idea ? you can see the quoted font in the box at the bottom of: http://i197.photobucket.com/albums/aa300/bhckjc93/AnneGeddes1.jpg TIA, Pierre. Pierre wrote: > hi, > > I'm looking for a freeware/share font similar to the one used by Anne > Geddes to write her name at the bottom of her pictures. any idea ? > > you can see the quoted font in the box at the bottom of: > http://i197.photobucket.com/albums/aa300/bhckjc93/AnneGeddes1...

PHP within PHP...
I took over the support of a website that is set up something like this inside one of the pages: include_once("header.php"); <?php //to get the content of the page they do this: $content = mysql_query("select content etc...); echo $content; ?> include_once("footer.php"); I am having problems evaluating any php that is used in the mysql content. Is there a way to get the mysql withing the mysql to run? Thank you for your time, Mandragon On Sep 17, 12:56 pm, Mandrago...@gmail.com wrote: > I took over the support of a website that is set up something like > this inside one of the pages: > > include_once("header.php"); > > <?php > //to get the content of the page they do this: > $content = mysql_query("select content etc...); > > echo $content; > ?> > > include_once("footer.php"); > > I am having problems evaluating any php that is used in the mysql > content. Is there a way to get the mysql withing the mysql to run? > > Thank you for your time, > > Mandragon Sorry, The question should read: "Is there a way to get the php withing the echo $htmlcontent to run?" Of course you are, $content is a resource. The MySQL Query resource. try this: $content = mysql_query('bla bla bla'); while ($row = mysql_fetch_assoc($content)) { $result[] = $row; } $content = $result; Now you can use $content ;). In answer to your edit... eval($co...

php to php obj
Hi All, Is there any tool to convert the .php files into its object files in deploying the files to other's server like java classes are deployed? Thanks in advance --AR John7481 <arjohn7481@hotmail.com> wrote or quoted: > Is there any tool to convert the .php files into its object files in > deploying the files to other's server like java classes are deployed? To what end? Do you want a PHP obfuscator? They tend not to be needed - since the code remains on the server. Do you want a PHP squeezer? Again - since PHP remains on the server that is of reduced importance. PHP obfuscators and squeezers are out there - but what exactly are you looking for? -- __________ |im |yler http://timtyler.org/ tim@tt1lock.org Remove lock to reply. With total disregard for any kind of safety measures Tim Tyler <tim@tt1lock.org> leapt forth and uttered: > John7481 <arjohn7481@hotmail.com> wrote or quoted: > >> Is there any tool to convert the .php files into its object >> files in deploying the files to other's server like java >> classes are deployed? > > To what end? > > Do you want a PHP obfuscator? They tend not to be needed - > since the code remains on the server. > > Do you want a PHP squeezer? Again - since PHP remains on the > server that is of reduced importance. > > PHP obfuscators and squeezers are out there - but what exactly > are you looking for? I think he'...

how to increase the font size on the axes. ( Not the name of the axis but the scale font )
how do i make the scaling font in the axes look bigger then the default size? for exporting for Power point presentation Please note that i know how to change the x label and y label font size all i need to know is how to change the scale associated with the labels. thanks On 07/10/2015 11:08 PM, aminul chowdhury wrote: > how do i make the scaling font in the axes look bigger then the default > size? for exporting for Power point presentation Please note that i know > how to change the x label and y label font size all i need to know is > how to change the scale associated...

Re: FONTS ? (name of default font using gplot cgmof97L ?)
radevenz@IX.NETCOM.COM sagely replied: >Not sure of the default, but you can specify your default using > goptions ftext="{true-type-font-name}", or > goptions ftext={SAS-font-name} > >CGMOF97L is also graphics device with 'hardware' fonts. You should be able >to specify which one you want by using > goptions CHARTYPE={chartype-#}, or > HWCGM### in font specifications (e.g. title f=HWCGM006 "This text >should >be rendered Times Roman Bold") > >Use SAS Explorer to view SASHELP.DEVICES.CGMOF97L. It should show >...

Finding raw font file data from an ATSUFontID or font name
I have a library that requires either a path to a ttf file or the raw data that is contained in a ttf file. I would like to get this data from an ATSUFontID for an installed system font. Is this possible on a Mac? In article <037a153d-30cc-44b0-82d8-8d9d8dd44208@m18g2000vbi.googlegroups.com>, Daniel Walter <d2walter@gmail.com> wrote: > I have a library that requires either a path to a ttf file or the raw > data that is contained in a ttf file. I would like to get this data > from an ATSUFontID for an installed system font. Is this possible on > a Mac? Sure. see "Curves In Quickdraw" http://www.mactech.com/articles/develop/issue_08/Reed_text.html The sample code shows how to parse a ttf file. On Jun 25, 2:17=A0am, David Phillip Oster <os...@ieee.org> wrote: > In article > <037a153d-30cc-44b0-82d8-8d9d8dd44...@m18g2000vbi.googlegroups.com>, > =A0Daniel Walter <d2wal...@gmail.com> wrote: > > > I have a library that requires either a path to a ttf file or the raw > > data that is contained in a ttf file. =A0I would like to get this data > > from an ATSUFontID for an installed system font. =A0Is this possible on > > a Mac? > > Sure. see "Curves In Quickdraw"http://www.mactech.com/articles/develop/is= sue_08/Reed_text.htmlThe > sample code shows how to parse a ttf file. My goal is to find the ttf file or the ttf file data. I don'...

Font recognition using PHP #2
Hi All, I have been assigned a project to develop a "font recognition application" using PHP. It goes something like this:- The user uploads an image file containing some text. The application is required to identify the text and the font used there. Below are links to 2 great applications which I would like to derive from:- http://www.myfonts.com/WhatTheFont/ http://www.imagaro.com/m2.html So far what I understand is, I'll need to have the font names along with their features to be stored in a database, then I'll need to analyze the image, pick up the characters from it, identify their typographical features and run a match on the database to get the top matching fonts. However right now I haven't got a clue as to how I go about the implementation of the above logic or whether there's some other approach. Need to start right from a scratch, any inputs/suggestions are greatly appreciated. Thanks in advance. ...

[Q] How can I delete fonts in Font Folder on OS 9.xx?
Hi! I created font installer. Installer was quit all application including Finder and move some fonts in Font Folder to System Folder for backup. Then, copy some fonts that I want to install into Font Folder. And then, delete som fonts in System Folder. But, when I delete font moved in System Folder, -47 error occurred. How can delete font file? Or, Can I delete font files in Font Folder? Let me know please... Thanks. ...

Fonts show in programs, but not in Fonts folder or via hard drive search!
I have a document that uses fonts that show as available in that program's font menu. But I can't find them in the OS 9 Fonts folder. I don't use a font management utility and have the fonts residing somewhere else. So WHERE ARE THEY???? I did a finder search but couldn't find them. It DOES seems like fonts can be named slightly differently than what actually appears in the font menu, but I still can't find them manually using this thinking. Help! Dale Dale Glaser <dglaser@pacific.net> wrote: > I have a document that uses fonts that show as available in that ...

Best PHP Training | PHP Development Training | PHP Training Institute
Tops Technologies provides php and mysql certification courses in ahmedabad, baroda, surat, Rajkot, Udaipur, Gujarat, india.PHP Training with MySQL is an introductory course in the PHP and MySQL technology. Mysql and php training course, php for beginners, sql training courses, PHP Training courses, php courses, mysql training courses, php mysql course. For More Details :- http://www.tops-int.com ...

WVW Hello world with 2 fonts or 2 font sizes of same font
could anyone write a small Hello World using more then 1 font or more sizes then one. I cant figure this one out. Thanks Yon ...

Web resources about - How do you generate an array of actual font names from your /fonts folder in PHP? - comp.lang.php

Facebook Testing ‘Select Ad Variations To Generate’ Option In Power Editor?
Facebook appears to be testing a new feature in Power Editor that allows users to more easily test different versions of their ads. continued… ...

Study: Facebook Page Post Ads generate 14% higher ROI for retail sector than Marketplace ads
Page Post Ads in the Facebook News Feed generate 14 percent higher return on investment for companies in the retail sector compared to Marketplace ...

In the Germany iPhone app market, how many downloads/day does one need to generate to become a Top 10 ...
Answer (1 of 3): It highly depends on the country of course. For Germany it takes on a typical day 4k downloads to hit the Top Overall 50 free ...

App Store - iRobohash - Generate unique Robot for you
Get iRobohash - Generate unique Robot for you on the App Store. See screenshots and ratings, and read customer reviews.

All sizes - Google Webmaster Tools - Generate robots.txt - Flickr - Photo Sharing!
Flickr is almost certainly the best online photo management and sharing application in the world. Show off your favorite photos and videos to ...

Generate Electricity with Peltier Module - The Seebeck Effect - YouTube
How to generate electricity with a Peltier module and the Seebeck effect along with info about the difference between a thermoelectric cooler ...

Andy Murray's moan over grunting just generates a groan
While Rafael Nadal was repositioning himself among the game's big four last week, Andy Murray was groaning about his opponents grunting to a ...

Inferno expected to generate abnormal, high-altitude cloud
A bizarre weather phenomenon known as a fire cloud is likely to form over the fire raging between Lithgow and Bilpin if weather conditions deteriorate ...

Westfield deal generates $69.5m in banker fees
J.P. Morgan, Rothschild, Citigroup, Credit Suisse, UBS and Morgan Stanley are among a host of investment banks to receive millions in fees.

New taste sensation Akiba generates excitement on opening night
Owners of Canberra's next big eatery, Akiba, are keen to differentiate themselves from the competition.

Resources last updated: 3/23/2016 9:09:51 PM