473,406 Members | 2,345 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Font in code


Hi,

I was wondering if there is way use a font that is somehow kept in the
code instead of having to load it? I am working on a single script
that so far can produce images and html but I have not been able to
figure out a way that it can also produce a font.

Thanks

Carl
http://www.gaihosa.com
Jun 2 '08 #1
16 1836
ca**********@gmail.com wrote:
Hi,

I was wondering if there is way use a font that is somehow kept in the
code instead of having to load it? I am working on a single script
that so far can produce images and html but I have not been able to
figure out a way that it can also produce a font.

Thanks

Carl
http://www.gaihosa.com
You can send PDF's? And embed fonts.

If you want a tight document format, thats generally the way to do it.

Jun 2 '08 #2
ca**********@gmail.com schreef:
Hi,

I was wondering if there is way use a font that is somehow kept in the
code instead of having to load it? I am working on a single script
that so far can produce images and html but I have not been able to
figure out a way that it can also produce a font.

Thanks

Carl
http://www.gaihosa.com
Hi Carl,

PHP doesn't use fonts itself: It is just code.

Some things that might be relevant:
- You can produce HTML/CSS that says to the browser which font to use.
- You can use fonts when producing images. (In that case the fonts PHP
needs must be available to PHP, duh).
- You PHP IDE can in most cases change its font (probably options-etc)

What is it excactly you are asking for?

Regards,
Erwin Moller
Jun 2 '08 #3
I know this sounds very odd. I'll better explain what I am trying to
do.

When my script calls for an image I let the it know via the query
variables as so: <image src="myscript.php?mode=image" />. When my
script is accessed in this fashion it only returns an image. It's also
does the same for the Ajax (which controlls the form), "myscript.php?
mode=ajax" and the HTML, "myscript.php?mode=html". Everything is
inline except the loading of fonts that are not in the GD Library.
That is the last thing I am hoping to accomplish such as so:

$image = imagecreatetruecolor(59, 20);
$text_color = imagecolorallocate($im, 0, 0, 0);
imagettftext($image, 10, 0, 3, 15, $text_color, "myscript.php?
mode=font", "my font");
if($mode == font){
echo $font;
}

Ofcourse this doesn't work so I thought I would ask.
Thankyou for all of your answers.
Carl.
http://www.gaihosa.com

On May 6, 5:26 am, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@spam yourself.comwrote:
carlberna...@gmail.com schreef:
Hi,
I was wondering if there is way use a font that is somehow kept in the
code instead of having to load it? I am working on a single script
that so far can produce images and html but I have not been able to
figure out a way that it can also produce a font.
Thanks
Carl
http://www.gaihosa.com

Hi Carl,

PHP doesn't use fonts itself: It is just code.

Some things that might be relevant:
- You can produce HTML/CSS that says to the browser which font to use.
- You can use fonts when producing images. (In that case the fonts PHP
needs must be available to PHP, duh).
- You PHP IDE can in most cases change its font (probably options-etc)

What is it excactly you are asking for?

Regards,
Erwin Moller
Jun 2 '08 #4
I know this sounds very odd. I'll better explain what I am trying to
do.

When my script calls for an image I let the it know via the query
variables as so: <image src="myscript.php?mode=image" />. When my
script is accessed in this fashion it only returns an image. It's also
does the same for the Ajax (which controlls the form), "myscript.php?
mode=ajax" and the HTML, "myscript.php?mode=html". Everything is
inline except the loading of fonts that are not in the GD Library.
That is the last thing I am hoping to accomplish such as so:

$image = imagecreatetruecolor(59, 20);
$text_color = imagecolorallocate($im, 0, 0, 0);
imagettftext($image, 10, 0, 3, 15, $text_color, "myscript.php?
mode=font", "my font");
if($mode == font){
echo $font;
}

Ofcourse this doesn't work so I thought I would ask.
Thankyou for all of your answers.
Carl.
http://www.gaihosa.com

On May 6, 5:26 am, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@spam yourself.comwrote:
carlberna...@gmail.com schreef:
Hi,
I was wondering if there is way use a font that is somehow kept in the
code instead of having to load it? I am working on a single script
that so far can produce images and html but I have not been able to
figure out a way that it can also produce a font.
Thanks
Carl
http://www.gaihosa.com

Hi Carl,

PHP doesn't use fonts itself: It is just code.

Some things that might be relevant:
- You can produce HTML/CSS that says to the browser which font to use.
- You can use fonts when producing images. (In that case the fonts PHP
needs must be available to PHP, duh).
- You PHP IDE can in most cases change its font (probably options-etc)

What is it excactly you are asking for?

Regards,
Erwin Moller
Jun 2 '08 #5
On 6 May, 13:15, "carlberna...@gmail.com" <carlberna...@gmail.com>
wrote:
On May 6, 5:26 am, Erwin Moller

<Since_humans_read_this_I_am_spammed_too_m...@spam yourself.comwrote:
carlberna...@gmail.com schreef:
Hi,
I was wondering if there is way use a font that is somehow kept in the
code instead of having to load it? I am working on a single script
that so far can produce images and html but I have not been able to
figure out a way that it can also produce a font.
Thanks
Carl
>http://www.gaihosa.com
Hi Carl,
PHP doesn't use fonts itself: It is just code.
Some things that might be relevant:
- You can produce HTML/CSS that says to the browser which font to use.
- You can use fonts when producing images. (In that case the fonts PHP
needs must be available to PHP, duh).
- You PHP IDE can in most cases change its font (probably options-etc)
What is it excactly you are asking for?
Regards,
Erwin Moller
I know this sounds very odd. I'll better explain what I am trying to
do.

When my script calls for an image I let the it know via the query
variables as so: <image src="myscript.php?mode=image" />. When my
script is accessed in this fashion it only returns an image. It's also
does the same for the Ajax (which controlls the form), "myscript.php?
mode=ajax" and the HTML, "myscript.php?mode=html". Everything is
inline except the loading of fonts that are not in the GD Library.
That is the last thing I am hoping to accomplish such as so:

$image = imagecreatetruecolor(59, 20);
$text_color = imagecolorallocate($im, 0, 0, 0);
imagettftext($image, 10, 0, 3, 15, $text_color, "myscript.php?
mode=font", "my font");

if($mode == font){
echo $font;

}

Ofcourse this doesn't work so I thought I would ask.

Thankyou for all of your answers.

Carl.

http://www.gaihosa.com
Please do not top post (top posting fixed)

It is still not at all obvious what you are trying to do.

You never load anything into $font, so you can't write it out.

But even ignoring that, what do you expct to be in $font?

Calling imagettftext($image, 10, 0, 3, 15, $text_color, "myscript.php?
mode=font", "my font"); will put the text "my font" into the image,
except that the font you have specified
"myscript.php?mode=font" is not valid.

An echo command outputs something to the browser, but what you want to
do is have a value for a font, inside the code.

I assume that you are not showing us the whole URLs as "myscript.php?
mode=image" has no way to specify what image is to be retrieved.

Is this possibly what you are looking for:

$image = imagecreatetruecolor(59, 20);
$text_color = imagecolorallocate($im, 0, 0, 0);
imagettftext($image, 10, 0, 3, 15, $text_color, $_GET['fonttype'], "my
font");
Jun 2 '08 #6
On May 6, 8:51 am, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 6 May, 13:15, "carlberna...@gmail.com" <carlberna...@gmail.com>
wrote:
On May 6, 5:26 am, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@spam yourself.comwrote:
carlberna...@gmail.com schreef:
Hi,
I was wondering if there is way use a font that is somehow kept in the
code instead of having to load it? I am working on a single script
that so far can produce images and html but I have not been able to
figure out a way that it can also produce a font.
Thanks
Carl
http://www.gaihosa.com
Hi Carl,
PHP doesn't use fonts itself: It is just code.
Some things that might be relevant:
- You can produce HTML/CSS that says to the browser which font to use.
- You can use fonts when producing images. (In that case the fonts PHP
needs must be available to PHP, duh).
- You PHP IDE can in most cases change its font (probably options-etc)
What is it excactly you are asking for?
Regards,
Erwin Moller
I know this sounds very odd. I'll better explain what I am trying to
do.
When my script calls for an image I let the it know via the query
variables as so: <image src="myscript.php?mode=image" />. When my
script is accessed in this fashion it only returns an image. It's also
does the same for the Ajax (which controlls the form), "myscript.php?
mode=ajax" and the HTML, "myscript.php?mode=html". Everything is
inline except the loading of fonts that are not in the GD Library.
That is the last thing I am hoping to accomplish such as so:
$image = imagecreatetruecolor(59, 20);
$text_color = imagecolorallocate($im, 0, 0, 0);
imagettftext($image, 10, 0, 3, 15, $text_color, "myscript.php?
mode=font", "my font");
if($mode == font){
echo $font;
}
Ofcourse this doesn't work so I thought I would ask.
Thankyou for all of your answers.
Carl.
http://www.gaihosa.com

Please do not top post (top posting fixed)

It is still not at all obvious what you are trying to do.

You never load anything into $font, so you can't write it out.

But even ignoring that, what do you expct to be in $font?

Calling imagettftext($image, 10, 0, 3, 15, $text_color, "myscript.php?
mode=font", "my font"); will put the text "my font" into the image,
except that the font you have specified
"myscript.php?mode=font" is not valid.

An echo command outputs something to the browser, but what you want to
do is have a value for a font, inside the code.

I assume that you are not showing us the whole URLs as "myscript.php?
mode=image" has no way to specify what image is to be retrieved.

Is this possibly what you are looking for:

$image = imagecreatetruecolor(59, 20);
$text_color = imagecolorallocate($im, 0, 0, 0);
imagettftext($image, 10, 0, 3, 15, $text_color, $_GET['fonttype'], "my
font");
Just wondering if there is a way to embed a font in your code such as
in a PDF.
Jun 2 '08 #7
On May 6, 8:51 am, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 6 May, 13:15, "carlberna...@gmail.com" <carlberna...@gmail.com>
wrote:
On May 6, 5:26 am, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@spam yourself.comwrote:
carlberna...@gmail.com schreef:
Hi,
I was wondering if there is way use a font that is somehow kept in the
code instead of having to load it? I am working on a single script
that so far can produce images and html but I have not been able to
figure out a way that it can also produce a font.
Thanks
Carl
http://www.gaihosa.com
Hi Carl,
PHP doesn't use fonts itself: It is just code.
Some things that might be relevant:
- You can produce HTML/CSS that says to the browser which font to use.
- You can use fonts when producing images. (In that case the fonts PHP
needs must be available to PHP, duh).
- You PHP IDE can in most cases change its font (probably options-etc)
What is it excactly you are asking for?
Regards,
Erwin Moller
I know this sounds very odd. I'll better explain what I am trying to
do.
When my script calls for an image I let the it know via the query
variables as so: <image src="myscript.php?mode=image" />. When my
script is accessed in this fashion it only returns an image. It's also
does the same for the Ajax (which controlls the form), "myscript.php?
mode=ajax" and the HTML, "myscript.php?mode=html". Everything is
inline except the loading of fonts that are not in the GD Library.
That is the last thing I am hoping to accomplish such as so:
$image = imagecreatetruecolor(59, 20);
$text_color = imagecolorallocate($im, 0, 0, 0);
imagettftext($image, 10, 0, 3, 15, $text_color, "myscript.php?
mode=font", "my font");
if($mode == font){
echo $font;
}
Ofcourse this doesn't work so I thought I would ask.
Thankyou for all of your answers.
Carl.
http://www.gaihosa.com

Please do not top post (top posting fixed)

It is still not at all obvious what you are trying to do.

You never load anything into $font, so you can't write it out.

But even ignoring that, what do you expct to be in $font?

Calling imagettftext($image, 10, 0, 3, 15, $text_color, "myscript.php?
mode=font", "my font"); will put the text "my font" into the image,
except that the font you have specified
"myscript.php?mode=font" is not valid.

An echo command outputs something to the browser, but what you want to
do is have a value for a font, inside the code.

I assume that you are not showing us the whole URLs as "myscript.php?
mode=image" has no way to specify what image is to be retrieved.

Is this possibly what you are looking for:

$image = imagecreatetruecolor(59, 20);
$text_color = imagecolorallocate($im, 0, 0, 0);
imagettftext($image, 10, 0, 3, 15, $text_color, $_GET['fonttype'], "my
font");
Just wondering if there is a way to embed a font in your code such as
in a PDF.
Jun 2 '08 #8
ca**********@gmail.com wrote:
On May 6, 8:51 am, Captain Paralytic <paul_laut...@yahoo.comwrote:
>On 6 May, 13:15, "carlberna...@gmail.com" <carlberna...@gmail.com>
wrote:
>>On May 6, 5:26 am, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@sp amyourself.comwrote:
carlberna...@gmail.com schreef:
Hi,
I was wondering if there is way use a font that is somehow kept in the
code instead of having to load it? I am working on a single script
that so far can produce images and html but I have not been able to
figure out a way that it can also produce a font.
Thanks
Carl
http://www.gaihosa.com
Hi Carl,
PHP doesn't use fonts itself: It is just code.
Some things that might be relevant:
- You can produce HTML/CSS that says to the browser which font to use.
- You can use fonts when producing images. (In that case the fonts PHP
needs must be available to PHP, duh).
- You PHP IDE can in most cases change its font (probably options-etc)
What is it excactly you are asking for?
Regards,
Erwin Moller
I know this sounds very odd. I'll better explain what I am trying to
do.
When my script calls for an image I let the it know via the query
variables as so: <image src="myscript.php?mode=image" />. When my
script is accessed in this fashion it only returns an image. It's also
does the same for the Ajax (which controlls the form), "myscript.php?
mode=ajax" and the HTML, "myscript.php?mode=html". Everything is
inline except the loading of fonts that are not in the GD Library.
That is the last thing I am hoping to accomplish such as so:
$image = imagecreatetruecolor(59, 20);
$text_color = imagecolorallocate($im, 0, 0, 0);
imagettftext($image, 10, 0, 3, 15, $text_color, "myscript.php?
mode=font", "my font");
if($mode == font){
echo $font;
}
Ofcourse this doesn't work so I thought I would ask.
Thankyou for all of your answers.
Carl.
http://www.gaihosa.com
Please do not top post (top posting fixed)

It is still not at all obvious what you are trying to do.

You never load anything into $font, so you can't write it out.

But even ignoring that, what do you expct to be in $font?

Calling imagettftext($image, 10, 0, 3, 15, $text_color, "myscript.php?
mode=font", "my font"); will put the text "my font" into the image,
except that the font you have specified
"myscript.php?mode=font" is not valid.

An echo command outputs something to the browser, but what you want to
do is have a value for a font, inside the code.

I assume that you are not showing us the whole URLs as "myscript.php?
mode=image" has no way to specify what image is to be retrieved.

Is this possibly what you are looking for:

$image = imagecreatetruecolor(59, 20);
$text_color = imagecolorallocate($im, 0, 0, 0);
imagettftext($image, 10, 0, 3, 15, $text_color, $_GET['fonttype'], "my
font");

Just wondering if there is a way to embed a font in your code such as
in a PDF.
No, as others have said - PHP doesn't use fonts. It generates HTML.

You can create an image, but the font you use must be available in a
font file.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 2 '08 #9
On Tue, 06 May 2008 19:18:01 +0200, Jerry Stuckle
<js*******@attglobal.netwrote:
ca**********@gmail.com wrote:
>On May 6, 8:51 am, Captain Paralytic <paul_laut...@yahoo.comwrote:
>>On 6 May, 13:15, "carlberna...@gmail.com" <carlberna...@gmail.com>
wrote:

On May 6, 5:26 am, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@s pamyourself.comwrote:
carlberna...@gmail.com schreef:
>Hi,
>I was wondering if there is way use a font that is somehow kept in
>the
>code instead of having to load it? I am working on a single script
>that so far can produce images and html but I have not been able to
>figure out a way that it can also produce a font.
>Thanks
>Carl
>http://www.gaihosa.com
Hi Carl,
PHP doesn't use fonts itself: It is just code.
Some things that might be relevant:
- You can produce HTML/CSS that says to the browser which font to
use.
- You can use fonts when producing images. (In that case the fonts
PHP
needs must be available to PHP, duh).
- You PHP IDE can in most cases change its font (probably options-
etc)
What is it excactly you are asking for?
Regards,
Erwin Moller
I know this sounds very odd. I'll better explain what I am trying to
do.
When my script calls for an image I let the it know via the query
variables as so: <image src="myscript.php?mode=image" />. Whenmy
script is accessed in this fashion it only returns an image. It's also
does the same for the Ajax (which controlls the form), "myscript.php?
mode=ajax" and the HTML, "myscript.php?mode=html". Everything is
inline except the loading of fonts that are not in the GD Library.
That is the last thing I am hoping to accomplish such as so:
$image = imagecreatetruecolor(59, 20);
$text_color = imagecolorallocate($im, 0, 0, 0);
imagettftext($image, 10, 0, 3, 15, $text_color, "myscript.php?
mode=font", "my font");
if($mode == font){
echo $font;
}
Ofcourse this doesn't work so I thought I would ask.
Thankyou for all of your answers.
Carl.
http://www.gaihosa.com
Please do not top post (top posting fixed)

It is still not at all obvious what you are trying to do.

You never load anything into $font, so you can't write it out.

But even ignoring that, what do you expct to be in $font?

Calling imagettftext($image, 10, 0, 3, 15, $text_color, "myscript.php?
mode=font", "my font"); will put the text "my font" into the image,
except that the font you have specified
"myscript.php?mode=font" is not valid.

An echo command outputs something to the browser, but what you want to
do is have a value for a font, inside the code.

I assume that you are not showing us the whole URLs as "myscript.php?
mode=image" has no way to specify what image is to be retrieved.

Is this possibly what you are looking for:

$image = imagecreatetruecolor(59, 20);
$text_color = imagecolorallocate($im, 0, 0, 0);
imagettftext($image, 10, 0, 3, 15, $text_color, $_GET['fonttype'], "my
font");
Just wondering if there is a way to embed a font in your code such as
in a PDF.

No, as others have said - PHP doesn't use fonts. It generates HTML.

You can create an image, but the font you use must be available in a
font file.

Well, theoretically PHP could create/output a font file, and theoretically
one could 'embed' the binary code in a static variable in the code. Noone
in his right mind would do this of course.
--
Rik Wasmus
Jun 2 '08 #10
On May 6, 8:51 am, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 6 May, 13:15, "carlberna...@gmail.com" <carlberna...@gmail.com>
wrote:
On May 6, 5:26 am, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@spam yourself.comwrote:
carlberna...@gmail.com schreef:
Hi,
I was wondering if there is way use a font that is somehow kept in the
code instead of having to load it? I am working on a single script
that so far can produce images and html but I have not been able to
figure out a way that it can also produce a font.
Thanks
Carl
http://www.gaihosa.com
Hi Carl,
PHP doesn't use fonts itself: It is just code.
Some things that might be relevant:
- You can produce HTML/CSS that says to the browser which font to use.
- You can use fonts when producing images. (In that case the fonts PHP
needs must be available to PHP, duh).
- You PHP IDE can in most cases change its font (probably options-etc)
What is it excactly you are asking for?
Regards,
Erwin Moller
I know this sounds very odd. I'll better explain what I am trying to
do.
When my script calls for an image I let the it know via the query
variables as so: <image src="myscript.php?mode=image" />. When my
script is accessed in this fashion it only returns an image. It's also
does the same for the Ajax (which controlls the form), "myscript.php?
mode=ajax" and the HTML, "myscript.php?mode=html". Everything is
inline except the loading of fonts that are not in the GD Library.
That is the last thing I am hoping to accomplish such as so:
$image = imagecreatetruecolor(59, 20);
$text_color = imagecolorallocate($im, 0, 0, 0);
imagettftext($image, 10, 0, 3, 15, $text_color, "myscript.php?
mode=font", "my font");
if($mode == font){
echo $font;
}
Ofcourse this doesn't work so I thought I would ask.
Thankyou for all of your answers.
Carl.
http://www.gaihosa.com

Please do not top post (top posting fixed)

It is still not at all obvious what you are trying to do.

You never load anything into $font, so you can't write it out.

But even ignoring that, what do you expct to be in $font?

Calling imagettftext($image, 10, 0, 3, 15, $text_color, "myscript.php?
mode=font", "my font"); will put the text "my font" into the image,
except that the font you have specified
"myscript.php?mode=font" is not valid.

An echo command outputs something to the browser, but what you want to
do is have a value for a font, inside the code.

I assume that you are not showing us the whole URLs as "myscript.php?
mode=image" has no way to specify what image is to be retrieved.

Is this possibly what you are looking for:

$image = imagecreatetruecolor(59, 20);
$text_color = imagecolorallocate($im, 0, 0, 0);
imagettftext($image, 10, 0, 3, 15, $text_color, $_GET['fonttype'], "my
font");
Just wondering if there is a way to embed a font in your code such as
in a PDF.
Jun 2 '08 #11
On May 6, 8:51 am, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 6 May, 13:15, "carlberna...@gmail.com" <carlberna...@gmail.com>
wrote:
On May 6, 5:26 am, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@spam yourself.comwrote:
carlberna...@gmail.com schreef:
Hi,
I was wondering if there is way use a font that is somehow kept in the
code instead of having to load it? I am working on a single script
that so far can produce images and html but I have not been able to
figure out a way that it can also produce a font.
Thanks
Carl
http://www.gaihosa.com
Hi Carl,
PHP doesn't use fonts itself: It is just code.
Some things that might be relevant:
- You can produce HTML/CSS that says to the browser which font to use.
- You can use fonts when producing images. (In that case the fonts PHP
needs must be available to PHP, duh).
- You PHP IDE can in most cases change its font (probably options-etc)
What is it excactly you are asking for?
Regards,
Erwin Moller
I know this sounds very odd. I'll better explain what I am trying to
do.
When my script calls for an image I let the it know via the query
variables as so: <image src="myscript.php?mode=image" />. When my
script is accessed in this fashion it only returns an image. It's also
does the same for the Ajax (which controlls the form), "myscript.php?
mode=ajax" and the HTML, "myscript.php?mode=html". Everything is
inline except the loading of fonts that are not in the GD Library.
That is the last thing I am hoping to accomplish such as so:
$image = imagecreatetruecolor(59, 20);
$text_color = imagecolorallocate($im, 0, 0, 0);
imagettftext($image, 10, 0, 3, 15, $text_color, "myscript.php?
mode=font", "my font");
if($mode == font){
echo $font;
}
Ofcourse this doesn't work so I thought I would ask.
Thankyou for all of your answers.
Carl.
http://www.gaihosa.com

Please do not top post (top posting fixed)

It is still not at all obvious what you are trying to do.

You never load anything into $font, so you can't write it out.

But even ignoring that, what do you expct to be in $font?

Calling imagettftext($image, 10, 0, 3, 15, $text_color, "myscript.php?
mode=font", "my font"); will put the text "my font" into the image,
except that the font you have specified
"myscript.php?mode=font" is not valid.

An echo command outputs something to the browser, but what you want to
do is have a value for a font, inside the code.

I assume that you are not showing us the whole URLs as "myscript.php?
mode=image" has no way to specify what image is to be retrieved.

Is this possibly what you are looking for:

$image = imagecreatetruecolor(59, 20);
$text_color = imagecolorallocate($im, 0, 0, 0);
imagettftext($image, 10, 0, 3, 15, $text_color, $_GET['fonttype'], "my
font");
Just wondering if there is a way to embed a font in your code such as
in a PDF.
Jun 2 '08 #12
Rik Wasmus wrote:
On Tue, 06 May 2008 19:18:01 +0200, Jerry Stuckle
<js*******@attglobal.netwrote:
>ca**********@gmail.com wrote:
>>On May 6, 8:51 am, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 6 May, 13:15, "carlberna...@gmail.com" <carlberna...@gmail.com>
wrote:

On May 6, 5:26 am, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@ spamyourself.comwrote:
>carlberna...@gmail.com schreef:
>>Hi,
>>I was wondering if there is way use a font that is somehow kept
>>in the
>>code instead of having to load it? I am working on a single script
>>that so far can produce images and html but I have not been able to
>>figure out a way that it can also produce a font.
>>Thanks
>>Carl
>>http://www.gaihosa.com
>Hi Carl,
>PHP doesn't use fonts itself: It is just code.
>Some things that might be relevant:
>- You can produce HTML/CSS that says to the browser which font to
>use.
>- You can use fonts when producing images. (In that case the fonts
>PHP
>needs must be available to PHP, duh).
>- You PHP IDE can in most cases change its font (probably
>options-etc)
>What is it excactly you are asking for?
>Regards,
>Erwin Moller
I know this sounds very odd. I'll better explain what I am trying to
do.
When my script calls for an image I let the it know via the query
variables as so: <image src="myscript.php?mode=image" />. When my
script is accessed in this fashion it only returns an image. It's also
does the same for the Ajax (which controlls the form), "myscript.php?
mode=ajax" and the HTML, "myscript.php?mode=html". Everything is
inline except the loading of fonts that are not in the GD Library.
That is the last thing I am hoping to accomplish such as so:
$image = imagecreatetruecolor(59, 20);
$text_color = imagecolorallocate($im, 0, 0, 0);
imagettftext($image, 10, 0, 3, 15, $text_color, "myscript.php?
mode=font", "my font");
if($mode == font){
echo $font;
}
Ofcourse this doesn't work so I thought I would ask.
Thankyou for all of your answers.
Carl.
http://www.gaihosa.com
Please do not top post (top posting fixed)

It is still not at all obvious what you are trying to do.

You never load anything into $font, so you can't write it out.

But even ignoring that, what do you expct to be in $font?

Calling imagettftext($image, 10, 0, 3, 15, $text_color, "myscript.php?
mode=font", "my font"); will put the text "my font" into the image,
except that the font you have specified
"myscript.php?mode=font" is not valid.

An echo command outputs something to the browser, but what you want to
do is have a value for a font, inside the code.

I assume that you are not showing us the whole URLs as "myscript.php?
mode=image" has no way to specify what image is to be retrieved.

Is this possibly what you are looking for:

$image = imagecreatetruecolor(59, 20);
$text_color = imagecolorallocate($im, 0, 0, 0);
imagettftext($image, 10, 0, 3, 15, $text_color, $_GET['fonttype'], "my
font");
Just wondering if there is a way to embed a font in your code such as
in a PDF.

No, as others have said - PHP doesn't use fonts. It generates HTML.

You can create an image, but the font you use must be available in a
font file.


Well, theoretically PHP could create/output a font file, and
theoretically one could 'embed' the binary code in a static variable in
the code. Noone in his right mind would do this of course.
Hi, Rik,

I thought about that, but I suspect the font file accessed with
fopen()/fread() or similar. And since the functions don't take a URL
(AFAIK, anyway), I don't know of any way to duplicate that in PHP.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 2 '08 #13
ca**********@gmail.com wrote:
On May 6, 8:51 am, Captain Paralytic <paul_laut...@yahoo.comwrote:
>On 6 May, 13:15, "carlberna...@gmail.com" <carlberna...@gmail.com>
wrote:
>>On May 6, 5:26 am, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@sp amyourself.comwrote:
carlberna...@gmail.com schreef:
Hi,
I was wondering if there is way use a font that is somehow kept in the
code instead of having to load it? I am working on a single script
that so far can produce images and html but I have not been able to
figure out a way that it can also produce a font.
Thanks
Carl
http://www.gaihosa.com
Hi Carl,
PHP doesn't use fonts itself: It is just code.
Some things that might be relevant:
- You can produce HTML/CSS that says to the browser which font to use.
- You can use fonts when producing images. (In that case the fonts PHP
needs must be available to PHP, duh).
- You PHP IDE can in most cases change its font (probably options-etc)
What is it excactly you are asking for?
Regards,
Erwin Moller
I know this sounds very odd. I'll better explain what I am trying to
do.
When my script calls for an image I let the it know via the query
variables as so: <image src="myscript.php?mode=image" />. When my
script is accessed in this fashion it only returns an image. It's also
does the same for the Ajax (which controlls the form), "myscript.php?
mode=ajax" and the HTML, "myscript.php?mode=html". Everything is
inline except the loading of fonts that are not in the GD Library.
That is the last thing I am hoping to accomplish such as so:
$image = imagecreatetruecolor(59, 20);
$text_color = imagecolorallocate($im, 0, 0, 0);
imagettftext($image, 10, 0, 3, 15, $text_color, "myscript.php?
mode=font", "my font");
if($mode == font){
echo $font;
}
Ofcourse this doesn't work so I thought I would ask.
Thankyou for all of your answers.
Carl.
http://www.gaihosa.com
Please do not top post (top posting fixed)

It is still not at all obvious what you are trying to do.

You never load anything into $font, so you can't write it out.

But even ignoring that, what do you expct to be in $font?

Calling imagettftext($image, 10, 0, 3, 15, $text_color, "myscript.php?
mode=font", "my font"); will put the text "my font" into the image,
except that the font you have specified
"myscript.php?mode=font" is not valid.

An echo command outputs something to the browser, but what you want to
do is have a value for a font, inside the code.

I assume that you are not showing us the whole URLs as "myscript.php?
mode=image" has no way to specify what image is to be retrieved.

Is this possibly what you are looking for:

$image = imagecreatetruecolor(59, 20);
$text_color = imagecolorallocate($im, 0, 0, 0);
imagettftext($image, 10, 0, 3, 15, $text_color, $_GET['fonttype'], "my
font");

Just wondering if there is a way to embed a font in your code such as
in a PDF.
You keep asking this and you keep being told no.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 2 '08 #14
On Tue, 06 May 2008 21:58:13 +0200, Jerry Stuckle
<js*******@attglobal.netwrote:
Rik Wasmus wrote:
>On Tue, 06 May 2008 19:18:01 +0200, Jerry Stuckle
<js*******@attglobal.netwrote:
>>No, as others have said - PHP doesn't use fonts. It generates HTML.

You can create an image, but the font you use must be available in a
font file.
Well, theoretically PHP could create/output a font file, and
theoretically one could 'embed' the binary code in a static variable in
the code. Noone in his right mind would do this of course.

I thought about that, but I suspect the font file accessed with
fopen()/fread() or similar. And since the functions don't take a URL
(AFAIK, anyway), I don't know of any way to duplicate that in PHP.
A quick check here confirms it: normal streams cannot be used as it seems
(probably because it will actually be GD doing the fopen()ing), it has to
be a file.
--
Rik Wasmus
Jun 2 '08 #15
In our last episode,
<39**********************************@j22g2000hsf. googlegroups.com>, the
lovely and talented ca**********@gmail.com broadcast on comp.lang.php:
Just wondering if there is a way to embed a font in your code such as
in a PDF.
This still is not making much sense. I think by "code" you mean html
markup. If so, the answer is 'no,' you cannot use PHP to generate html that
does stuff html cannot do.

If you cannot write a prototype document in HTML that does what you want in
HTML, you cannot get PHP to generate an HTML document that somehow does
something magical that HTML cannot do.

You could have a browser-side script that tried to install a font in the
browser for use with your document, but that isn't HTML and it isn't PHP,
and whether or exactly how to do this is subject matter for a browser-side
scripting group.

You can indicate a preferred font in a style element or attribute in HTML or
in the deprecated font element, but if the browser does not have that font,
it will fall back on something generic --- which is why it is a good idea to
have a list of fonts, increasing in generality up to a generic font family.

If you must have PDF-like control over the appearance of your document,
serve pdf.

--
Lars Eighner <http://larseighner.com/us****@larseighner.com
Countdown: 258 days to go.
Jun 2 '08 #16
In our last episode,
<2a**********************************@m44g2000hsc. googlegroups.com>, the
lovely and talented ca**********@gmail.com broadcast on comp.lang.php:
Just wondering if there is a way to embed a font in your code such as
in a PDF.
Once again, PHP cannot generate magic-HTML that does stuff that is
impossible in HTML. You can ask in an HTML group how to embed a font in
HTML. If (as I have a strong suspicion) the answer is "No way," then the
answer is still "No way" for HTML generated by PHP.

--
Lars Eighner <http://larseighner.com/us****@larseighner.com
Countdown: 258 days to go.
Jun 2 '08 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Shmuel (Seymour J.) Metz | last post by:
I've got a document that StarOffice converted into HTML, and I'm trying to clean up the cuft that it generated. I put together some basic styles, and tied using them: the results are puzzling. The...
10
by: Richard R Plourde | last post by:
I've got a problem that IE doesn't seem to use the entire font unicode subgroups from a hinted font file. When I display the following web page in IE 6 as opposed to Firefox 1.0 PR. Check out...
3
by: Barry Anderberg | last post by:
I'm using the .NET Memory Profiler by Sci Tech and I wrote a little test application to verify something odd I observed and it appears that System.Drawing.Font fails to dispose of its FontFamily. ...
4
by: Eric Eggermann | last post by:
Hello all, I'm building an app that lays out and prints flash cards. Now the card might be any size, but when the user is working on the card, I draw the preview isotropically, as large as...
7
by: Sakharam Phapale | last post by:
Hi All, How to preserve the old font properties while changing new one? I posted same question 2 months back, but I had very small time then. eg. "Shopping for" is a text in RichTextBox and...
6
by: BobAchgill | last post by:
Has anyone had success with writing text using a private font that was not already installed to the system? When I try the example code in NET Framework Developer's Guide called “Creating a...
24
by: Tony Girgenti | last post by:
Hello. Developing a Windows Form program in VS.NET VB, .NET Framework 1.1.4322 on a windows XP Pro, SP2. Before printing a document, i want to set the font to a font that is only available...
2
by: Patti | last post by:
I am building an application using VB.NET 1.1 and I have an issue with Font properties in my Radio Button Lists and Check Box Lists. My issue is that the Font Names and Font Size for these...
2
by: kheitmann | last post by:
OK, so I have a blog. I downloaded the "theme" from somewhere and have edited a few areas to suit my needs. There are different font themes within the page theme. Long story short, my "Text Posts"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.