Re: Font request

Discussion in 'C Programming' started by Bartc, Aug 3, 2008.

  1. Bartc

    Bartc Guest

    "Malcolm McLean" <> wrote in message
    news:...
    > Anyone got a monospaced font in C source?
    >
    > (What I'm looking for is something like
    >
    > char A = "0000000000110000000000"
    > "0000000001001000000000"
    > "0000000011111100000000"
    > "0000000100000010000000"
    > "0000001000000001000000"
    > "0000001000000001000000";
    >
    > etc). Basically the bitpatterns / vectors in a data file.


    How you tried just reading sample characters from the screen?

    This is what I've just tried (the program is not C so can't post). And the
    results, using a courier-type font, look like:

    char *c65[] /*A*/ = (
    "00000000",
    "00000000",
    "00000000",
    "00000000",
    "00000000",
    "00111000",
    "00011000",
    "00011000",
    "00100100",
    "00100100",
    "00111100",
    "01000010",
    "11100111",
    "00000000",
    "00000000",
    "00000000",
    "00000000");

    (The full set is quite big, and depends also on the bitmap size you need
    (this was at 8x17). If this is any use I can send a full set by email. The
    actual C format may need to be specified more clearly. Note this format
    doesn't include any horizontal gap.)

    --
    Bartc
    Bartc, Aug 3, 2008
    #1
    1. Advertising

  2. Bartc

    Bartc Guest

    "Malcolm McLean" <> wrote in message
    news:...
    >
    > "Bartc" <> wrote in message
    > news:eek:rnlk.37129$...
    >> "Malcolm McLean" <> wrote in message
    >> news:...
    >>> Anyone got a monospaced font in C source?


    >> How you tried just reading sample characters from the screen?
    >>
    >> This is what I've just tried (the program is not C so can't post). And
    >> the results, using a courier-type font, look like:
    >>
    >> char *c65[] /*A*/ = (
    >> "00000000",
    >> "00000000",


    > Thanks, that's what I need.
    >
    > It's for a barcode generator so ideally the fonts will be 12 pixels wide.
    >
    > regniztar at btinternet dot com


    Ok, I've sent a couple of files by email to this address (as content, not
    attachments). Both 12 pixels wide, one bold one normal. For characters 32 to
    127 only. Ascii coded.

    I don't know exactly how they will be used in C (I haven't tried), although
    I'm guessing you might need an array similar to the following (perhaps
    replace NULLs with c32 or c63):

    char **chartable[] = {
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0 9*/
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 10 19*/
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 20 29*/
    NULL, NULL, c32, c33, c34, c35, c36, c37, c38, c39, /* 30 39*/
    c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, /* 40 49*/
    c50, c51, c52, c53, c54, c55, c56, c57, c58, c59, /* 50 59*/
    c60, c61, c62, c63, c64, c65, c66, c67, c68, c69, /* 60 69*/
    c70, c71, c72, c73, c74, c75, c76, c77, c78, c79, /* 70 79*/
    c80, c81, c82, c83, c84, c85, c86, c87, c88, c89, /* 80 89*/
    c90, c91, c92, c93, c94, c95, c96, c97, c98, c99, /* 90 99*/
    c100, c101, c102, c103, c104, c105, c106, c107, c108, c109, /* 100 109*/
    c110, c111, c112, c113, c114, c115, c116, c117, c118, c119, /* 110 119*/
    c120, c121, c122, c123, c124, c125, c126, c127};

    (Or I suppose I could just have generated a 3-dimensional array to start
    with.)

    Now I can turn my smooth fonts back on (they screw up the capture
    otherwise)...

    --
    Bartc
    Bartc, Aug 3, 2008
    #2
    1. Advertising

  3. Bartc

    Richard Guest

    "Bartc" <> writes:

    > "Malcolm McLean" <> wrote in message
    > news:...
    >> Anyone got a monospaced font in C source?
    >>
    >> (What I'm looking for is something like
    >>
    >> char A = "0000000000110000000000"
    >> "0000000001001000000000"
    >> "0000000011111100000000"
    >> "0000000100000010000000"
    >> "0000001000000001000000"
    >> "0000001000000001000000";
    >>
    >> etc). Basically the bitpatterns / vectors in a data file.

    >
    > How you tried just reading sample characters from the screen?
    >
    > This is what I've just tried (the program is not C so can't post). And


    Why can you not post it? Are you insane?
    Richard, Aug 4, 2008
    #3
  4. In article <g772bo$dpn$>,
    Richard <> wrote:
    >"Bartc" <> writes:
    >
    >> "Malcolm McLean" <> wrote in message
    >> news:...
    >>> Anyone got a monospaced font in C source?
    >>>
    >>> (What I'm looking for is something like
    >>>
    >>> char A = "0000000000110000000000"
    >>> "0000000001001000000000"
    >>> "0000000011111100000000"
    >>> "0000000100000010000000"
    >>> "0000001000000001000000"
    >>> "0000001000000001000000";
    >>>
    >>> etc). Basically the bitpatterns / vectors in a data file.

    >>
    >> How you tried just reading sample characters from the screen?
    >>
    >> This is what I've just tried (the program is not C so can't post). And

    >
    >Why can you not post it? Are you insane?


    He doesn't want to get smashed by the regs. Quite understandable.
    Kenny McCormack, Aug 4, 2008
    #4
  5. Bartc

    Bartc Guest

    "Richard" <> wrote in message
    news:g772bo$dpn$...
    > "Bartc" <> writes:
    >
    >> "Malcolm McLean" <> wrote in message
    >> news:...
    >>> Anyone got a monospaced font in C source?
    >>>
    >>> (What I'm looking for is something like
    >>>
    >>> char A = "0000000000110000000000"
    >>> "0000000001001000000000"
    >>> "0000000011111100000000"
    >>> "0000000100000010000000"
    >>> "0000001000000001000000"
    >>> "0000001000000001000000";
    >>>
    >>> etc). Basically the bitpatterns / vectors in a data file.

    >>
    >> How you tried just reading sample characters from the screen?
    >>
    >> This is what I've just tried (the program is not C so can't post). And

    >
    > Why can you not post it? Are you insane?


    No. The code was in a private language, not C, and uses a private API for
    some graphics calls. But even if created in C was likely to be too big to
    post and would have been a Win32 application using ASCII, not in portable C.

    However just out of interest, the code is given below as a way of
    illustrating the idea of capturing bitmap fonts by writing to a screen. This
    code is case-insensitive and //-style comments begin with !.

    !Grab fixed pitch font bitmaps from screen
    !Screen must not use smooth fonts during capture

    define c1=32
    define c2=127

    !define c1='A'
    !define c2='Z'

    var chx,chy

    PROC START=
    w:=gxwindow !create a default window

    gxtextfont(w,"courier new","b",23) !size 23 (pix or pts?) == 12 pix wide

    gxbgndmode(w,1) !draw background pixels

    (chx,chy):=seq(gxchardim(w)) !dimensions of char cell

    f:=createfile("fontdata")

    for c:=c1 to c2 do
    gxtext(w,chr(c),0,0) !draw one char in top left of window
    m:=readchar(w) !read pixels into char matrix
    writechar(f,c,m) !write char data in C format
    od

    closefile(f)

    waitclosemess
    END

    FUNCTION READCHAR(w)=
    !Read pixel data as array of strings, one string per row
    !Each string contains "1" for foreground and "0" for background
    !Screen pixels must contain 0 (black) for foreground

    mat:=()
    for y:=1 to chy do
    row:=""
    for x:=1 to chx do
    row+:=(gxpixel(w,x-1,y-1)|"0"|"1")
    od
    mat[y]:=row
    od
    return mat
    END

    FUNCTION WRITECHAR(f,c,mat)= !write char matrix as C code

    print #f,c:"char *c%d[] "
    println #f,"/*",chr(c),"*/ = {"

    for y:=1 to chy do
    println #f," """,mat[y],"""",(y=chy|"};"|",")
    od
    println #f
    END

    --
    Bartc
    Bartc, Aug 4, 2008
    #5
  6. Bartc

    Guest

    On Aug 4, 11:09 pm, "Bartc" <> wrote:
    > usenet troll <> wrote in message


    <snip>

    > > Why can you not post it? Are you insane?

    >
    > No. The code was in a private language, not C, and uses a private API for
    > some graphics calls. But even if created in C was likely to be too big to
    > post and would have been a Win32 application using ASCII, not in portable C.


    Please don't reply to trolls.

    > However just out of interest, the code is given below as a way of
    > illustrating the idea of capturing bitmap fonts by writing to a screen. This
    > code is case-insensitive and //-style comments begin with !.


    The code is off-topic in comp.lang.c.
    Set follow-ups to a relevant group (if any) or just don't post it.

    <snip code>
    , Aug 7, 2008
    #6
  7. Bartc

    Bartc Guest

    <> wrote in message
    news:...
    > On Aug 4, 11:09 pm, "Bartc" <> wrote:
    >> usenet troll <> wrote in message

    >
    > <snip>
    >
    >> > Why can you not post it? Are you insane?

    >>
    >> No. ...


    > Please don't reply to trolls.


    I don't consider 'Richard' a troll.

    >> However just out of interest, the code [which generates standard C] is
    >> given below


    > The code is off-topic in comp.lang.c.


    Thanks for clarifying this. I've been worrying about it for the last three
    days.

    --
    Bartc
    Bartc, Aug 7, 2008
    #7
  8. Bartc

    Guest

    On Aug 7, 1:36 pm, "Bartc" <> wrote:
    > <> wrote in message
    >
    > news:...
    >
    > > On Aug 4, 11:09 pm, "Bartc" <> wrote:
    > >> usenet troll <> wrote in message

    >
    > > <snip>

    >
    > >> > Why can you not post it? Are you insane?

    >
    > >> No. ...

    > > Please don't reply to trolls.

    >
    > I don't consider 'Richard' a troll.


    Irrelevant. He is.

    > >> However just out of interest, the code [which generates standard C] is
    > >> given below

    > > The code is off-topic in comp.lang.c.

    >
    > Thanks for clarifying this. I've been worrying about it for the last three
    > days.


    You're welcome, but worrying about this so much suggests a visit to a
    psychotherapist.
    , Aug 7, 2008
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Karl Hungus

    Font class, external font files question

    Karl Hungus, Feb 4, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    523
    Karl Hungus
    Feb 4, 2004
  2. =?Utf-8?B?Tmlja3k=?=
    Replies:
    2
    Views:
    705
    Matt Berther
    Feb 20, 2005
  3. Michael Glavitsch
    Replies:
    1
    Views:
    760
    Roedy Green
    Jul 15, 2003
  4. Nick Spinel
    Replies:
    0
    Views:
    931
    Nick Spinel
    Jul 25, 2003
  5. mttc
    Replies:
    2
    Views:
    2,382
    Roedy Green
    Jul 3, 2009
Loading...

Share This Page