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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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. |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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"); |
|
|||
|
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. |
|
|||
|
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. |
|
|||
|
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 ================== |
|
|||
|
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 |