473,605 Members | 2,640 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Which fixed size (width) font are usable/recommendable ?

I want to embed some source code lines in an article on a web page.
As usual I want to use a fixed sized font for this souce code lines (read: the letters should
have all the same width).

The font normally used when I declare a <PRE>...</PRE> tag is very ugly.

Is there another font which I can use to display fixed size text ?

Arty

Jul 20 '05 #1
21 86433
in post <news:bt******* ******@news.t-online.com>
Arthur Connor said:
I want to embed some source code lines in an article on a web page.
The font normally used when I declare a <PRE>...</PRE> tag is very ugly.


then change the font your browser uses.

pre,code{font-family:monospac e;}

the visitor will get their nice yummy preferred mono font (although it
may not be mono but thats something you need not worry about)
--
brucie
02/January/2004 07:47:32 pm kilo
Jul 20 '05 #2

"brucie" <sh**@bruciesus enetshit.info> wrote in message
news:bt******** ****@ID-117621.news.uni-berlin.de...
in post <news:bt******* ******@news.t-online.com>
Arthur Connor said:
I want to embed some source code lines in an article on a web page.
The font normally used when I declare a <PRE>...</PRE> tag is very ugly.


then change the font your browser uses.

pre,code{font-family:monospac e;}

the visitor will get their nice yummy preferred mono font (although it
may not be mono but thats something you need not worry about)


I'd suggest at least one real font, just in case the browser is going to use
a bad font as the default. Ups your chances.

pre {font-family: 'Courier New', monospace;} is what I usually do.
Jul 20 '05 #3
Arthur Connor wrote:
I want to embed some source code lines in an article on a web page.
As usual I want to use a fixed sized font for this souce code lines
(read: the letters should have all the same width).

The font normally used when I declare a <PRE>...</PRE> tag is very
ugly.

Is there another font which I can use to display fixed size text ?


PRE can be defined in CSS - in the head it would be something like
<style type="text/css">
pre
{
font-family:courier, "courier new", monospace;
font-size:1em;
color:#000;
background-color:#fff;
}
</style>

Adjust to taste.

--
PeterMcC
If you feel that any of the above is incorrect,
inappropriate or offensive in any way,
please ignore it and accept my apologies.
Jul 20 '05 #4
in news:bt******** *****@news.t-online.com,
Arthur Connor typed:
I want to embed some source code lines in an article on a web page.
As usual I want to use a fixed sized font for this souce code lines
(read: the letters should have all the same width).

The font normally used when I declare a <PRE>...</PRE> tag is very
ugly.

Is there another font which I can use to display fixed size text ?

Arty

Do you really want to set the font? If you do, then you can simply do
something like this.....

pre {font-family:courier, yukamoondo,seri f}


Jul 20 '05 #5

[seen on comp.infosystem s.www.authoring.html and cross-posted
to comp.infosystem s.www.authoring.stylesheets with f'up set...]

On Fri, 2 Jan 2004, PeterMcC wrote:
Arthur Connor wrote:
Is there another font which I can use to display fixed size text ?


PRE can be defined in CSS - in the head it would be something like
<style type="text/css">
pre
{
font-family:courier, "courier new", monospace;
font-size:1em;
color:#000;
background-color:#fff;
}
</style>


Since the original questioner seems - by the nature of their question
- be only at the very start of understanding the idea of HTML in
conjunction with CSS, I would want to be very careful in offering
unsolicited suggestions about font size and colo(u)r when they were
asking only about a face. Also I'm doubtful about the appropriateness
of proposing the use of an inline stylesheet as the only answer given.

If I answered this question at all, I think I'd want to point to the
benefits of an external stylesheet, not forgetting to stress that this
was only a *proposal* which client agents may action or not, according
to circumstances, and so forth.

Btw, in all my encounters with Courier fonts, the names have been
capitalised (Courier, "Courier New"). The font name matching rules in
CSS are deliberately vague - to accommodate differences between
systems - but I think it's fair to say that specifying the font name
*exactly* will stand the best chance of hitting the mark.

Finally could I mention the potential risks, if a wide character
repertoire is involved, of specifying a font which potentially might
have a smaller repertoire than has the reader's default monospace
font. See the discussion which leads up to this conclusion:
http://ppewww.ph.gla.ac.uk/~flavell/...onts.html#dont

The situation with monospace fonts is particularly fraught, since the
monospace fonts that are routinely distributed with MS OSes seem to
have a quite limited repertoire compared to their proportional fonts
(again, this is discussed on the above-cited page).

best regards
Jul 20 '05 #6
In article <bt************ *@news.t-online.com>, ar***@redseven. com
says...
Is there another font which I can use to display fixed size text ?


Any non proportional font will do it. Courier is probably the most
common.

--
Whitecrest Entertainment
www.whitecrestent.com
Jul 20 '05 #7
Arthur Connor wrote:
I want to embed some source code lines in an article on a web page.
As usual I want to use a fixed sized font for this souce code lines
(read: the letters should have all the same width).

The font normally used when I declare a <PRE>...</PRE> tag is very
ugly.

Is there another font which I can use to display fixed size text ?


If you use "font-family: monospace" in CSS to define the font in a
pre-element, you leave it up to the user which font is being displayed
as fixed width font. If you still want to define your own font, you can
try Courier New, Courier or Lucida Console, but keep in mind that if the
user doesn't have that font installed, you can't be sure which font will
be displayed!

You can also specify more then one font, and specify "monospace" as a
last option, so if none of the fonts you specified are available, the
user's system will choose the monospace font as set by the user:

for example: font-family: "Lucida Console", Courier, "Courier New",
monospace;

--
Daan Stolp
Jul 20 '05 #8
"Arthur Connor" <ar***@redseven .com> wrote in message
news:bt******** *****@news.t-online.com...
I want to embed some source code lines in an article on a web page.
As usual I want to use a fixed sized font for this souce code lines (read: the letters should have all the same width).

The font normally used when I declare a <PRE>...</PRE> tag is very ugly.

Is there another font which I can use to display fixed size text ?

Arty


Courier New and Lucida Console spring to mind.

--
Ryan Stewart, A1C USAF
805 CSPTS/SCBE
Jul 20 '05 #9
On Fri, 2 Jan 2004, Daan wrote:
If you use "font-family: monospace" in CSS to define the font in a
pre-element, you leave it up to the user which font is being displayed
as fixed width font.


And if you don't specify font-family in the stylesheet, surely
the same thing happens? So what's the point?
Jul 20 '05 #10

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

Similar topics

2
5822
by: dlgproc | last post by:
I wanted to display text in a label on a Windows form in a fixed-width font. In C++ Windows API programming I’ve always used: GetStockObject(SYSTEM_FIXED_FONT). Using the following C# code to do the same throws an exception: private static extern IntPtr GetStockObject(int fnObject); private static Font GetSystemFont() {
1
2474
by: Drew | last post by:
Hey, thanks in advance for helping me out with my problem: I have a datagrid which is embedded in another datagrid. The datagrid is filled directly by a dataset generated from a sql query. So far everything is fine. Now i try to format the embedded datagrid - e.g. setting font size and the column size/width of each column. Everything is working fine, except the width of the columns.
3
2734
by: Noozer | last post by:
I need a fast "console" type control. Basically a textbox that uses a fixed width font and can be configured for a specific width and height. I may need to apply colour and double width & height fonts as well. This is for a VT terminal emulator. I had done some investigation with VB6 and using the GDI to provide a fast interface to create a custom control... Before I end up going this route, is there anything in VB.Net that could help? ...
0
1515
by: Ken Varn | last post by:
I have a managed C++ assembly in which I need to interact with some 'C' APIs that take fixed size 'C' data blocks. I need to wrap these data blocks into a managed object. It seems like a lot of redundancy and extra code to have to marshal .net data from managed to unmanaged for this. Is there some built-in method in managed C++ that can allow me to create a managed structure and convert it into a fixed size 'C' data block? I am trying...
8
3713
by: chrisben | last post by:
Hi, If I am not sure how many items will be in my Hashtable/ArrayList dynamically (multiple threads can add/remove/check the item), however, I can estimate the total number will not exceed 60000. How much can I gain in term of performance if I decalre the hash as Hashtable h = new Hashtable(60000); instead of
2
4055
by: neuneudr | last post by:
Hi everybody, I'm scratching my head with a CSS problem. I want to have the following (the two pics have these size for a good reason, the whole point of the page is basically to show these pices at these fixed sizes) : spacer - fixed size picture - spacer - fixed size picture - spacer
3
4332
by: patl | last post by:
Hi all, I am trying to write a terminal emulator using Javascript + AJAX and I need to create an 80x25 table (each cell contains 1 character) in which I can update the contents of each cell very efficiently. The tests I have done up to now seem to indicate that each time I update the cell contents (using innerHTML), the entire table is resized and redrawn. This makes my app very slow.
1
3166
by: kendrick82 | last post by:
Hi, I would like to seek some advise and assistance regarding the following matter as I am new to VB.Net. I'll appreciate any helps render. I am developing a VB application using VB.Net 2003 to extract data from text files and import it into datatable. The format of the text file is fixed length/width. Eg. http://img174.imageshack.us/img174/8457/untitledpp4.jpg I am having trouble to do so as I am not sure how to start. I had done...
3
3846
by: jerrygadd | last post by:
Hi can anyone please help? I have a need to make a table of fixed size, containing three rows, where the middle row auto expands to fill the remaining space between the top and bottom rows. Here is what I have so far, unfortunately using height:100% for the middle row blows the size of the table! <html> <head> <title>Auto expanding middle row!</title>
0
7999
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8423
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8411
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8067
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6740
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
3911
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3956
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1530
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1270
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.