Results 1 to 9 of 9

Thread: changing the fonts in out put

  1. #1
    Join Date
    Feb 2009
    Posts
    156
    Thanks
    0
    Thanked 4 Times in 3 Posts

    Default changing the fonts in out put

    hi, i am working in a php site, i want to give the output of 1 page in my native language, but i know every computer doesnot have this font installed on his/her computer, so how i can give out put of that page?


    should i need to use any javascript or css for this or PHP is sufficient, give ur suggestions plz.......

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Alternate fonts can and should be in the css, as not every computer has any particular font, though they all should have one each of the three generic fonts - serif, sans-serif, and monospace.

    So you can do something like:

    Code:
    body {
     font-family: arial, sans-serif;
    }
    The user will see this in arial if they have it, in their default sans-serif font if not. As many font's as desired may be listed, separated by commas as shown above. But the last font listed should always be one of the three generic ones mentioned. If a font listed has one or more spaces in its name, its name should be enclosed in quotes.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Feb 2009
    Posts
    156
    Thanks
    0
    Thanked 4 Times in 3 Posts

    Default

    actually i was asking abt the font in any specific language, as i want to write in punjabi, so i use AMRIT.ttf font, only a omputer which has this specific font can show page in readable format., others will show page in unreadable format... hope u got the point

  4. #4
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    I can see only two ways for you to do this. The first is to post a link to the font where the visitor can download and install the font and then will be able to view the page.

    Or you could load the font to your website and create an image file in png format where you utilize the font for an image file with the Punjabi font.

    Just for fun here is what the code would look like:

    PHP Code:
    <?php
    $im    
    imagecreatetruecolor(11040);
    $green imagecolorallocate($im02550);
    $red   imagecolorallocate($im25500);
    imagefilledrectangle($im009040$red);
    $font imageloadfont('include/04b.gdf');
    imagestring($im$font00'Hello'$green);
    header('Content-type: image/png');
    imagepng($im);
    imagedestroy($im);
    ?>
    The above assumes that 04b.gdf was uploaded to your site.

    Otherwise if a computer does not have the font on their computer I do not see how their computer would be able to interpret the font. Java maybe?
    To choose the lesser of two evils is still to choose evil. My personal site

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    For this reason, websites usually just tell their visitors to go and download a font.

    It sounds like a lot to ask, perhaps, but realistically there is no nice way around it.

    Something like using images instead will just slow you (and the website) down and then they can't copy/paste text, etc.

    If you need a website in Punjabi, just require visitors to at least have the font. If you serve it in UTF8, it should be generally compatible if the font exists. More systems these days are now preinstalled with lots of fonts, so the situation is getting better.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #6
    Join Date
    Feb 2009
    Posts
    156
    Thanks
    0
    Thanked 4 Times in 3 Posts

    Default

    i can visit yahoo.com in punjabi, but there is no Punjabi font installed on my computer, but still i can read all the news, how its possible, n these are not the images, its simple text only

    u can visit this page
    http://in.punjabi.yahoo.com/
    all the txt is in readable format, either there is no font installed

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    That page is served in the UTF-8 character encoding and the literal characters for that language are supported. If you view the source code, you will see the characters. Some basic code page and font support on the receiving computer may still be required. The site's developers probably have a keyboard and OS that writes these characters, but there are probably ways (though laborious) to write them with a standard keyboard and OS as well.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #8
    Join Date
    Feb 2009
    Posts
    156
    Thanks
    0
    Thanked 4 Times in 3 Posts

    Default

    yes i also noticed it when i opened view source,

    do u know hw to implement this ?
    means how i can give this implement in my web page ?
    do i need any additional coding as wel? or what to do...?

    is any1 is having any idea how to write in Punjabi kyboard in a web page?

  9. #9
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Generally, (for your page) all you need is the meta tag for the encoding (example on a blank valid page):

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    
    </head>
    <body>
    
    </body>
    </html>
    However, some servers override these tags and serve the content in some other encoding. If so, you must change that on the server, at least for your site. At the same time, it is generally best for all but the most specialized servers to at least default to utf-8 encoding, though many do not. If you are not in control of this on your host and it prevents your page from being served in the required encoding, there is a good chance that your host would be willing to make the adjustment for you if asked.

    As for typing in punjabi on your computer, ideally you would want to get a punjabi keyboard or some sort of overlay for your existing keyboard, so you can see what characters you are typing. But all that is required is that you install and activate the punjabi code page for the keyboard interface. These code pages generally come with your OS or can be obtained from the website of the manufacturer of your OS, as can instructions on installing and setting different code pages for your OS. Many OS versions from various manufacturers come in various language versions already specifically setup for a computer designed to operate in a specific non-English language.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •