Flash, PHP: Font sizes don't match

In summary, the conversation is about the difference in font sizes between Flash and GD images in PHP. It is suggested that this difference may be due to Flash using pixels and PHP using points as units of measurement. Some possible solutions are mentioned, such as using a cascading style sheet or setting font sizes in pixels instead of points. Additionally, using imagefontwidth() and imagefontheight() in GD or drawing with imagettftext() instead of imagestring() may also help with determining the required space for text in Flash using PHP.
  • #1
mtanti
172
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
  • #2
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?
 
  • #3
Are you sure that Flash uses pixels rather than points? Well that would explain it... Although on some tutorials I found it uses points...
 
  • #4
Flash has pixel fonts, but they are essentially just images. I have no idea why they would be different sizes.
 
  • #5
php uses points (using gd2)... but I have no idea how to change the units in either php or flash...
 
  • #6
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:
  • #7
but that only works with monospaced fonts. I need a way to change size type.
 
  • #8
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().
 
  • #9
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.
 

1. Why are my font sizes not matching in Flash and PHP?

This could be due to the fact that Flash and PHP use different methods for calculating font sizes. In Flash, font sizes are measured in pixels, while in PHP, font sizes are measured in points. This can result in slight discrepancies in the actual size of the font.

2. How can I fix the mismatched font sizes in Flash and PHP?

One solution is to manually adjust the font sizes in your code to ensure that they are consistent between Flash and PHP. Another option is to use a conversion tool to convert the font sizes from pixels to points or vice versa.

3. Can I use CSS to control font sizes in both Flash and PHP?

Yes, you can use CSS to set font sizes in both Flash and PHP. However, keep in mind that the default units for font sizes in Flash and PHP are different, so you may need to adjust your CSS code accordingly.

4. Are there any other factors that could contribute to font size discrepancies between Flash and PHP?

Yes, the font itself can also play a role in the perceived size of the font. For example, a bold font may appear larger than a regular font, even if they are set to the same size in the code.

5. Is there a way to standardize font sizes in Flash and PHP?

One way to ensure consistency in font sizes between Flash and PHP is to use a standard font that is available in both platforms. This can help minimize any discrepancies caused by different font types.

Similar threads

  • Programming and Computer Science
Replies
4
Views
814
  • Programming and Computer Science
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
979
  • Precalculus Mathematics Homework Help
Replies
7
Views
943
  • Programming and Computer Science
Replies
10
Views
2K
  • Programming and Computer Science
Replies
6
Views
5K
Replies
4
Views
666
  • Special and General Relativity
Replies
28
Views
2K
  • STEM Academic Advising
Replies
9
Views
5K
  • Introductory Physics Homework Help
Replies
22
Views
215
Back
Top