PHP Flash, PHP: Font sizes don't match

AI Thread Summary
The discussion centers on the discrepancies in font sizes between Flash and GD images in PHP. Participants note that Flash may use pixel measurements while PHP typically uses points, leading to inconsistencies in text display. There is uncertainty regarding Flash's font measurement, with some suggesting it utilizes points in certain contexts. To address the issue, users propose experimenting with CSS styles to adjust font sizes, such as using "px" instead of "pt" for pixel sizes. Additionally, functions like imagefontwidth() and imagefontheight() in PHP can help determine font dimensions, and using imagettftext() may provide better control over text rendering. The core challenge remains the differing measurement units between Flash and PHP, which complicates achieving uniform text sizes across both platforms.
mtanti
Messages
172
Reaction score
0
Has anyone noticed that the font size for Flash and the font size for GD images in PHP don't give the same text size?
 
Technology news on Phys.org
mtanti said:
Has anyone noticed that the font size for Flash and the font size for GD images in PHP don't give the same text size?

Maybe they use different measurements? Flash goes by pixel, PHP by point?
 
Are you sure that Flash uses pixels rather than points? Well that would explain it... Although on some tutorials I found it uses points...
 
Flash has pixel fonts, but they are essentially just images. I have no idea why they would be different sizes.
 
php uses points (using gd2)... but I have no idea how to change the units in either php or flash...
 
You could possibly use a cascading style sheet or set a style attribute for an element and experiment with the different font sizes.

For example, you could use style="font-size:9pt;" inside an element tag or set the style for a paragraph with the class "example" by saying <style>p.example{font-size:9pt;}</style>


You can use px instead of pt to get the font size in pixels. Here is some info which might be useful.

http://www.w3schools.com/css/pr_font_font-size.asp"
 
Last edited by a moderator:
but that only works with monospaced fonts. I need a way to change size type.
 
You can use imagefontwidth() and imagefontheight() to get the size of a given font in GD. This may help, but if not, you can try drawing with imagettftext() instead of imagestring().
 
that's what I do but I need to see how much space will be required for text to show in flash using php. since flash uses pixels and php uses points, the dimensions will not match.
 

Similar threads

Replies
2
Views
2K
Replies
1
Views
2K
Replies
11
Views
1K
Replies
12
Views
2K
Replies
4
Views
2K
Replies
4
Views
3K
Back
Top