Font in code

This is a discussion on Font in code within the PHP Language forums, part of the PHP Programming Forums category; Hi, I was wondering if there is way use a font that is somehow kept in the code instead of ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-06-2008
carlbernardi@gmail.com
 
Posts: n/a
Default 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
Reply With Quote
  #2 (permalink)  
Old 05-06-2008
The Natural Philosopher
 
Posts: n/a
Default Re: Font in code

carlbernardi@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.

Reply With Quote
  #3 (permalink)  
Old 05-06-2008
Erwin Moller
 
Posts: n/a
Default Re: Font in code

carlbernardi@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
Reply With Quote
  #4 (permalink)  
Old 05-06-2008
carlbernardi@gmail.com
 
Posts: n/a
Default Re: Font in code

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.com> wrote:
> 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


Reply With Quote
  #5 (permalink)  
Old 05-06-2008
carlbernardi@gmail.com
 
Posts: n/a
Default Re: Font in code

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.com> wrote:
> 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


Reply With Quote
  #6 (permalink)  
Old 05-06-2008
Captain Paralytic
 
Posts: n/a
Default Re: Font in code

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.com> wrote:
> > 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");
Reply With Quote
  #7 (permalink)  
Old 05-06-2008
carlbernardi@gmail.com
 
Posts: n/a
Default Re: Font in code

On May 6, 8:51 am, Captain Paralytic <paul_laut...@yahoo.com> wrote:
> 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.com> wrote:
> > > 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.
Reply With Quote
  #8 (permalink)  
Old 05-06-2008
carlbernardi@gmail.com
 
Posts: n/a
Default Re: Font in code

On May 6, 8:51 am, Captain Paralytic <paul_laut...@yahoo.com> wrote:
> 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.com> wrote:
> > > 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.
Reply With Quote
  #9 (permalink)  
Old 05-06-2008
Jerry Stuckle
 
Posts: n/a
Default Re: Font in code

carlbernardi@gmail.com wrote:
> On May 6, 8:51 am, Captain Paralytic <paul_laut...@yahoo.com> wrote:
>> 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.com> wrote:
>>>> 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.
jstucklex@attglobal.net
==================

Reply With Quote
  #10 (permalink)  
Old 05-06-2008
Rik Wasmus
 
Posts: n/a
Default Re: Font in code

On Tue, 06 May 2008 19:18:01 +0200, Jerry Stuckle
<jstucklex@attglobal.net> wrote:

> carlbernardi@gmail.com wrote:
>> On May 6, 8:51 am, Captain Paralytic <paul_laut...@yahoo.com> wrote:
>>> 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.com> wrote:
>>>>> 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
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:46 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0