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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Arthur Connor

    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

  • brucie

    #2
    Re: Which fixed size (width) font are usable/recommendable ?

    in post <news:bt3ef6$80 d$05$1@news.t-online.com>
    Arthur Connor said:
    [color=blue]
    > 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.[/color]

    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

    Comment

    • Neal

      #3
      Re: Which fixed size (width) font are usable/recommendable ?


      "brucie" <shit@bruciesus enetshit.info> wrote in message
      news:bt3esv$2t2 3e$1@ID-117621.news.uni-berlin.de...[color=blue]
      > in post <news:bt3ef6$80 d$05$1@news.t-online.com>
      > Arthur Connor said:
      >[color=green]
      > > 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.[/color]
      >
      > 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)[/color]

      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.


      Comment

      • PeterMcC

        #4
        Re: Which fixed size (width) font are usable/recommendable ?

        Arthur Connor wrote:[color=blue]
        > 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 ?[/color]

        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.

        Comment

        • Disco Octopus

          #5
          Re: Which fixed size (width) font are usable/recommendable ?

          in news:bt3ef6$80d $05$1@news.t-online.com,
          Arthur Connor typed:[color=blue]
          > 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[/color]
          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}




          Comment

          • Alan J. Flavell

            #6
            Re: Which fixed size (width) font are usable/recommendable ?


            [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:
            [color=blue]
            > Arthur Connor wrote:
            >[color=green]
            > > Is there another font which I can use to display fixed size text ?[/color]
            >
            > 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>[/color]

            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:


            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

            Comment

            • Whitecrest

              #7
              Re: Which fixed size (width) font are usable/recommendable ?

              In article <bt3ef6$80d$05$ 1@news.t-online.com>, artyC@redseven. com
              says...[color=blue]
              > Is there another font which I can use to display fixed size text ?[/color]

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

              --
              Whitecrest Entertainment

              Comment

              • Daan

                #8
                Re: Which fixed size (width) font are usable/recommendable ?

                Arthur Connor wrote:[color=blue]
                > 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 ?[/color]

                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


                Comment

                • Ryan Stewart

                  #9
                  Re: Which fixed size (width) font are usable/recommendable ?

                  "Arthur Connor" <artyC@redseven .com> wrote in message
                  news:bt3ef6$80d $05$1@news.t-online.com...[color=blue]
                  > 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:[/color]
                  the letters should[color=blue]
                  > 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[/color]

                  Courier New and Lucida Console spring to mind.

                  --
                  Ryan Stewart, A1C USAF
                  805 CSPTS/SCBE


                  Comment

                  • Alan J. Flavell

                    #10
                    Re: Which fixed size (width) font are usable/recommendable ?

                    On Fri, 2 Jan 2004, Daan wrote:
                    [color=blue]
                    > 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.[/color]

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

                    Comment

                    • Jukka K. Korpela

                      #11
                      Re: Which fixed size (width) font are usable/recommendable ?

                      artyC@redseven. com (Arthur Connor) wrote:
                      [color=blue]
                      > 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.[/color]

                      The monospace fonts that are most commonly available on people's
                      browsers are Courier New and Lucida Console. I guess Courier comes
                      next. They have rather different characteristics - similar shape, but
                      varying x-height and other properties. Yet, the font that a browser
                      uses by default might be something still more different,

                      I would use

                      <pre><code>.. .</code></pre>

                      (just to be logical - it probably has no effect on default rendering)

                      and the CSS rule

                      code { font-family: "Courier New", monospace; }

                      The reason is that Courier New is a reasonable and very widely
                      available font, usually an improvement over the browser default.
                      You could reduce the font slightly (say code { font-size: 85%; })
                      if you think that monospace font is too big as compared with normal
                      text. The point is that Courier New _is_ rather big in x-height and in
                      character width.

                      --
                      Yucca, http://www.cs.tut.fi/~jkorpela/
                      Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html


                      Comment

                      • John McGaw

                        #12
                        Re: Which fixed size (width) font are usable/recommendable ?

                        "Arthur Connor" <artyC@redseven .com> wrote in message
                        news:bt3ef6$80d $05$1@news.t-online.com...[color=blue]
                        > 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:[/color]
                        the letters should[color=blue]
                        > 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
                        >[/color]

                        There a bunch of fonts out there. Sadly you are limited to what your readers
                        have installed on their various systems. Unless you can get font embedding
                        to work and that is something I've not spent enough time with to comment on.

                        But back to the real word, shouldn't you be marking your source code up with
                        <code>...</code> instead of <pre>...</pre> as described under W3C's
                        "Structured Text" recommendations ?

                        --
                        John McGaw
                        [Knoxville, TN, USA]

                        Return address will not work. Please
                        reply in group or through my website:


                        Comment

                        • Bob

                          #13
                          Re: Which fixed size (width) font are usable/recommendable ?

                          On Fri, 2 Jan 2004 10:43:03 +0100, artyC@redseven. com (Arthur Connor)
                          wrote:
                          [color=blue]
                          >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).[/color]

                          You can get monospaced fonts in HTML using <code>, <tt>, <pre>.
                          [color=blue]
                          >The font normally used when I declare a <PRE>...</PRE> tag is very ugly.[/color]

                          That's because it's a monospaced font. But, since it looks like
                          most "code", it's probably OK.
                          [color=blue]
                          >Is there another font which I can use to display fixed size text ?[/color]

                          There is no other way to specify fixed fonts that will be reliable
                          across platforms. You can choose some specific fonts but the odds
                          of finding them on multiple platforms are low.

                          Comment

                          • Henri Sivonen

                            #14
                            Re: Which fixed size (width) font are usable/recommendable ?

                            In article <Pine.LNX.4.53. 0401021404470.2 0327@ppepc56.ph .gla.ac.uk>,
                            "Alan J. Flavell" <flavell@ph.gla .ac.uk> wrote:
                            [color=blue]
                            > On Fri, 2 Jan 2004, Daan wrote:
                            >[color=green]
                            > > 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.[/color]
                            >
                            > And if you don't specify font-family in the stylesheet, surely
                            > the same thing happens?[/color]

                            Not in Mozilla. In Mozilla, the UA style sheet has
                            font-family: -moz-fixed;

                            The practical difference is with font size.

                            --
                            Henri Sivonen
                            hsivonen@iki.fi

                            Mozilla Web Author FAQ: http://mozilla.org/docs/web-developer/faq.html

                            Comment

                            • Toby A Inkster

                              #15
                              Re: Which fixed size (width) font are usable/recommendable ?

                              Arthur Connor wrote:
                              [color=blue]
                              > Is there another font which I can use to display fixed size text ?[/color]

                              See the CodeStyle.org font survey for commonly installed fonts:



                              I would recommend the following CSS:

                              pre {
                              font-family: "Lucida Console", monospace;
                              }

                              --
                              Toby A Inkster BSc (Hons) ARCS
                              Contact Me - http://www.goddamn.co.uk/tobyink/?page=132

                              Comment

                              Working...