473,513 Members | 2,263 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript/CSS Font Detector

Hi Group,

I have discovered a technique by which we can be able to detect if a
particular font is present in a user's machine. Below is a brief info
about the script. You can find more info at my website
http://www.lalit.org/lab/fontdetect.php

"Javascript/CSS Font Detector"

This Javascript code can be used to guess if a particular font is
present in the users machine. It uses simple Javascript and some CSS
rules to check whether that font is available. This may be help of
desktop-like web application developers when they want to provide
different skins or fonts preferences to their users. This may also
help various blog skin designers which can provide different fonts for
different users based on the list of fonts that their users have. I
mean with these we dont have to always rely on the most common fonts
always, like Arial, Verdana or Times New Roman etc.

I have also made a working demo of the script:
http://www.lalit.org/lab/fontdetect.php

Please send me your bugs, suggestions, comments.

Cheers!
Lalit Patel

Mar 11 '07 #1
5 2793
On Sun, 11 Mar 2007 06:19:31 +0100, Lalit <la********@gmail.comwrote:
Hi Group,

I have discovered a technique by which we can be able to detect if a
particular font is present in a user's machine. Below is a brief info
about the script. You can find more info at my website
http://www.lalit.org/lab/fontdetect.php

"Javascript/CSS Font Detector"

This Javascript code can be used to guess if a particular font is
present in the users machine. It uses simple Javascript and some CSS
rules to check whether that font is available. This may be help of
desktop-like web application developers when they want to provide
different skins or fonts preferences to their users. This may also
help various blog skin designers which can provide different fonts for
different users based on the list of fonts that their users have. I
mean with these we dont have to always rely on the most common fonts
always, like Arial, Verdana or Times New Roman etc.

I have also made a working demo of the script:
http://www.lalit.org/lab/fontdetect.php

Please send me your bugs, suggestions, comments.

Cheers!
Lalit Patel
First of all: excellent idea!

Second: You may want to test this on wide monitors (16:9) and in the Opera
browser as well. Your script only detected Arial on my computer, though I
do have many of the others installed as well.

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Mar 11 '07 #2
On Mar 11, 9:29 pm, OmegaJunior
<omegajun...@spamremove.omegajunior.netwrote:
First of all: excellent idea!
Thanks a lot.
Second: You may want to test this on wide monitors (16:9) and in the Opera
browser as well. Your script only detected Arial on my computer, though I
do have many of the others installed as well.
It now works on Opera 9.10. I don't have any access wide monitors. If
you can find one, please test the script and mail me the results.
Thanks for your effort.

Regards,
Lalit

Mar 12 '07 #3
Lalit wrote:

[ http://www.lalit.org/lab/fontdetect.php ]
I don't have any access wide monitors. If
you can find one, please test the script
The width of the monitor is irrelevant. It is the width of the browsers
window that is important.

A normal browser window (~800 pixels wide)
http://barefile.com.au/normal.jpg

A narrow browser window:
http://barefile.com.au/narrow.jpg

A very wide browser window (notice and use the horizontal scroll bar):
http://barefile.com.au/wide.jpg

You should not be specifying that right hand margin in %. There is a fixed
size image to the right so you should be using px.

If there were a [sort of] fixed sized, say, navigaion bar, to the right then
you would us em.
and mail me the results.
Thanks for your effort.
Post here. See the results here.

--
Richard.
Mar 12 '07 #4
On Mon, 12 Mar 2007 09:12:14 +0100, Lalit <la********@gmail.comwrote:
On Mar 11, 9:29 pm, OmegaJunior
<omegajun...@spamremove.omegajunior.netwrote:
>First of all: excellent idea!

Thanks a lot.
>Second: You may want to test this on wide monitors (16:9) and in the
Opera
browser as well. Your script only detected Arial on my computer, though
I
do have many of the others installed as well.

It now works on Opera 9.10. I don't have any access wide monitors. If
you can find one, please test the script and mail me the results.
Thanks for your effort.

Regards,
Lalit
Excellent job! It works and detected all fonts!

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Mar 16 '07 #5
Lalit wrote:
Hi Group,

I have discovered a technique by which we can be able to detect if a
particular font is present in a user's machine. Below is a brief info
about the script. You can find more info at my website
http://www.lalit.org/lab/fontdetect.php

"Javascript/CSS Font Detector"

This Javascript code can be used to guess if a particular font is
present in the users machine. It uses simple Javascript and some CSS
rules to check whether that font is available. This may be help of
desktop-like web application developers when they want to provide
different skins or fonts preferences to their users. This may also
help various blog skin designers which can provide different fonts for
different users based on the list of fonts that their users have. I
mean with these we dont have to always rely on the most common fonts
always, like Arial, Verdana or Times New Roman etc.

I have also made a working demo of the script:
http://www.lalit.org/lab/fontdetect.php

Please send me your bugs, suggestions, comments.

Cheers!
Lalit Patel

This is extremely clever. Nice work!

It had a 100% accuracy rate on my computer with the fonts listed, and
even worked for every font I manually entered.

Jeremy
Mar 19 '07 #6

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

Similar topics

2
2312
by: Joh | last post by:
Hello, (sorry long) i think i have missed something in the code below, i would like to design some kind of detector with python, but i feel totally in a no way now and need some advices to...
4
3816
by: JesusFreak | last post by:
From: us_traveller@yahoo.com (JesusFreak) Newsgroups: microsoft.public.scripting.jscript Subject: toolbar script problem NNTP-Posting-Host: 192.92.126.136 Recently, I downloaded the following...
43
5528
by: Gremlin | last post by:
If you are not familiar with the halting problem, I will not go into it in detail but it states that it is impossible to write a program that can tell if a loop is infinite or not. This is a...
8
3625
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
3
2082
by: anthonybrough | last post by:
I have an asp page that has a form to collect user data in a form. when the user clicks submit the input is validated. If any fields are not acceptable the user clicks on a button to go back to...
8
6143
by: rajesh | last post by:
< script language = javascript c =...
1
2552
by: KRISHNA PRAVI | last post by:
the error is "runtime error object expected" here is the code....................................................................................... <script language="javascript"...
5
2676
by: loveshack | last post by:
Can anyone help me please (i am quite a novice, but having fun learning). Im not sure if this is an ASP problem, a javascript problem or a browser problem. Firstly, everything i have written...
0
7171
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
7547
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7541
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...
1
5098
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...
0
4751
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3240
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1607
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
461
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.