473,394 Members | 1,701 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Font request

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.

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

Aug 3 '08 #1
16 1356
On Sun, 03 Aug 2008 18:57:12 +0100, Malcolm McLean wrote:
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.
Have you tried the linux kernel sources?
www.kernel.org

Then look in the folder
drivers/video/console
for files with the word font in the name.

Please do us a favor and share your code too, when you are finished.

sf
Aug 3 '08 #2
On Aug 3, 1:57*pm, "Malcolm McLean" <regniz...@btinternet.comwrote:
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.

--
Free games and programming goodies.http://www.personal.leeds.ac.uk/~bgy1mm
If I remember correctly the GLUT library for OpenGL has a couple of
bitmap fonts encoded in the source. It's in C and sources are
available.

Aug 3 '08 #3
"Malcolm McLean" <re*******@btinternet.comwrote in message
news:KZ******************************@bt.com...
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

Aug 3 '08 #4

"Bartc" <bc@freeuk.comwrote in message
news:or******************@text.news.virginmedia.co m...
"Malcolm McLean" <re*******@btinternet.comwrote in message
news:KZ******************************@bt.com...
>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.)
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
--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

Aug 3 '08 #5

"Malcolm McLean" <re*******@btinternet.comwrote in message
news:aL******************************@bt.com...
>
"Bartc" <bc@freeuk.comwrote in message
news:or******************@text.news.virginmedia.co m...
>"Malcolm McLean" <re*******@btinternet.comwrote in message
news:KZ******************************@bt.com...
>>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

Aug 3 '08 #6

"Bartc" <bc@freeuk.comwrote in message

Thanks a lot.
Aug 3 '08 #7
"Bartc" <bc@freeuk.comwrites:
"Malcolm McLean" <re*******@btinternet.comwrote in message
news:KZ******************************@bt.com...
>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?
Aug 4 '08 #8
In article <g7**********@registered.motzarella.org>,
Richard <rg****@gmail.comwrote:
>"Bartc" <bc@freeuk.comwrites:
>"Malcolm McLean" <re*******@btinternet.comwrote in message
news:KZ******************************@bt.com...
>>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.

Aug 4 '08 #9

"jellybean stonerfish" <st********@geocities.comwrote in message
>
Please do us a favor and share your code too, when you are finished.
It's on the website, under BarCodes.

Unfortunately I don't have a reader, so I need someone to test it.

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

Aug 4 '08 #10
On Aug 4, 11:40 am, "Malcolm McLean" <regniz...@btinternet.comwrote:
"jellybean stonerfish" <stonerf...@geocities.comwrote in message
Please do us a favor and share your code too, when you are finished.

It's on the website, under BarCodes.

Unfortunately I don't have a reader, so I need someone to test it.
I must be misunderstanding something. It's on which website? I'd like
to get the code too.
(I worked on something similar years ago, trying to develop my own
Hebrew alphabet, but I never actually got it off the paper and onto a
computer. It was mostly just a waste of time.

-- Marty Amandil
Aug 4 '08 #11

"Amandil" <ma******@gmail.comwrote in message news:
On Aug 4, 11:40 am, "Malcolm McLean" <regniz...@btinternet.comwrote:
>"jellybean stonerfish" <stonerf...@geocities.comwrote in message
Please do us a favor and share your code too, when you are finished.

It's on the website, under BarCodes.

Unfortunately I don't have a reader, so I need someone to test it.

I must be misunderstanding something. It's on which website? I'd like
to get the code too.
(I worked on something similar years ago, trying to develop my own
Hebrew alphabet, but I never actually got it off the paper and onto a
computer. It was mostly just a waste of time.
Click in my sig. Or cut and paste the url into a web browser if you are not
set up for embedded links.

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

Aug 4 '08 #12
"Richard" <rg****@gmail.comwrote in message
news:g7**********@registered.motzarella.org...
"Bartc" <bc@freeuk.comwrites:
>"Malcolm McLean" <re*******@btinternet.comwrote in message
news:KZ******************************@bt.com...
>>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

Aug 4 '08 #13
On Aug 4, 11:09 pm, "Bartc" <b...@freeuk.comwrote:
usenet troll <rgr...@gmail.comwrote 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 '08 #14

<vi******@gmail.comwrote in message
news:ec**********************************@34g2000h sf.googlegroups.com...
On Aug 4, 11:09 pm, "Bartc" <b...@freeuk.comwrote:
>usenet troll <rgr...@gmail.comwrote 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
Aug 7 '08 #15
On Aug 7, 1:36 pm, "Bartc" <b...@freeuk.comwrote:
<vipps...@gmail.comwrote in message

news:ec**********************************@34g2000h sf.googlegroups.com...
On Aug 4, 11:09 pm, "Bartc" <b...@freeuk.comwrote:
usenet troll <rgr...@gmail.comwrote 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 '08 #16

"Bartc" <bc@freeuk.comwrote in message
>
Thanks for clarifying this. I've been worrying about it for the last three
days.
There's a big difference between the person who tries to go along with the
consensus on topicality, but maybe draws the line in a different place to
where another poster would draw it, and the person who deliberately tries to
impose a personal view of topicality on the group.

Anyway, thanks for your font. It is being used in a freeware barcode
generator.

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

Aug 8 '08 #17

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

Similar topics

7
by: StaZ | last post by:
Hello I have a ASP script that generates a jpg/gif image using the Overpower.ImageLib component. I do all my tests on my own intranet server before uploading it to the webhost Actually i...
3
by: Dave | last post by:
Hi, I am relatively new to css and am trying to find the font-size I like best to use as default. I would prefer to use em values as I found that it looks consistent between Firefox and IE,...
11
by: eomer | last post by:
My site is very small, and plain - it will mostly be text (for now). I have used a good mix of css in the design. With usability in mind I would like to add some specific functionality (with the...
4
by: Matt | last post by:
Another interesting issue: I set the default font on most of my forms to what I want the text in my controls to show up as (say, Verdana 9pt.), and then just change the font on labels and buttons...
13
by: al jones | last post by:
I think I need to degrade this to make it work so I'll ask a really basic question. I'm trying to display a set of fonts that are *not* installed but are present on my computer. Is there any...
2
by: Ben Long | last post by:
I'm curious if it is possible to detect the browsers default font and size? Most of the posts on this topic predate Windows XP, IE 5.5, Mozilla Firefox, et al. I've searched up and down the DOM...
24
by: Harris Kosmidis | last post by:
I have a site up and running (www.solsoft.gr). I tested it with FF2 and IE6 and works ok with some IE hacks. Ok the CSS isn't good cause I started designing it with another look and the customer...
17
by: teser3 | last post by:
I can put out a Word Doc from PHP but if I try and manipulate the font size in the PHP part it outputs a blank Word Document. Here is what I have: <?php $fname="report.doc"; $handle = fopen(...
1
by: sesling | last post by:
I have created several queries that request data from the user. When the user launches the query a pop up box will appear and ask for some requested data. However, the text in the pop window is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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
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
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...

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.