Hi,


I want to change the font size of text in C language for printing text.

Thanks in Advance.


Ashish

Member Avatar for iamthwee

What do you mean, change the font size in the command prompt, or in the text file you're piping it to?

What do you mean, change the font size in the command prompt, or in the text file you're piping it to?

Hi,
i want to mean , the change the size in text file

ashish

Member Avatar for iamthwee

>i want to mean , the change the size in text file

Oh I don't know about that. I would probably pipe it to a *.html file instead.

It allows you to easily change the font, and it's size amongst other things.


For example write this to a html file, which is essentially just saving it with the .html extension...

<html>
<font size="6">hello</font>
</html>

i am generating report in text file from c language .

and i want fits all columns in a page so i want to reduce the size of text.


Plz help me out...


Ashish

Member Avatar for iamthwee

i am generating report in text file from c language .

and i want fits all columns in a page so i want to reduce the size of text.


Plz help me out...


Ashish

Ok then, well how about you just open notepad, which I assume is the text editor you are using and change the font size to something smaller.

Then your program should, by default write to your files using the font size and style. I think?

I always set it to lucida console font size 10, it helps when you're aligning columns.

Hello

i want to handle this size of text through C Program only then how i can handle

Ashish

Member Avatar for iamthwee

Sorrie kiddo you're loosing me now.

That's as much as I know. When you've finished the C program can't you just manually change it back to your original font size. I don't see what the problem is?

Also in notepad if you uncheck wordwrap you can fit all the columns on the page and just use the scrollbars to view it all.

Format>wordwrap

Erm, you can only set the font size and font whatever if you save the file in a format that provides some extension on formatting, say, like Rich-Text Format (RTF), Hypertext Markup Language (HTML and/or XHTML), Microsoft Word Document, or Portable Document Format (PDF). In other words, you will have to research on one of these formats, and implement them into your C program. I suggest you go with HTML because it's probably the easiest. If you want to work with other formats, try searching Google for their format specification. Alternatively, you can try searching for libraries already written that will write into the format of desire.

Hope this helps.

If you mean you want to change front at a laser printer attached directly to your computer or on a network -- that is a pretty complex topic all in itself. There are several c++ classes that can make it somewhat easier, and all require more advanced knowledge of c++. Here is probably one of the more easier examples.

If it's an html file then just open it through your C code and append <font size="+somevalue"> after beginning body tag and </font > before closing body tag.

If it's an html file then just open it through your C code and append <font size="+somevalue"> after beginning body tag and </font > before closing body tag.

that will work ok in a web browser, but I don't think a laser printer or other text editors such as Notepad will interpret it. It will just simply print the tags as you typed them.

Member Avatar for iamthwee

that will work ok in a web browser, but I don't think a laser printer or other text editors such as Notepad will interpret it. It will just simply print the tags as you typed them.

It will work as long as you open it up as a .html in your web browser. Like you said if you open it up from notepad it won't, but that should be obvious? Try it and see.

It will work as long as you open it up as a .html in your web browser. .

I thought that was what I said. However, the OP needs to clarify his question -- print to what? have a browser display the text on the screen or print it on a printer?

Member Avatar for iamthwee

I thought that was what I said. However, the OP needs to clarify his question -- print to what? have a browser display the text on the screen or print it on a printer?

I thought that's what I said, fourth post down, it seems people like repeating me. ;)

It's true though the OP needs to clarify what he means. I suspect his problem is something altogether different.

I guess no further explaination is needed required for the OP's initial requirement.
He needs to
1. Print the results to a text file
2. Change the font size that is written in to the text file.

Astronox's answer is the most complete regarding these requirements.
You cant change the font size written in to the text file, because NO font formatting information, like Bold, italic, underline can be stored in the text file. A text file stores only the text information. Not the glyph information. The only formatting possible are the ones done with newlines, tabs ... So a big NO YOU CAN'T DO THAT will do.

Member Avatar for iamthwee

[satire]

>You can't change the font size written in to the text file

Of course you can, not from the c program of course, but you do so from notepad directly. It's just that the entire file will be that size. I think that's all he wants. Just for it to fit into an A4 sheet or something so he can print it off from the printer?

>Astronox's answer is the most complete regarding these requirements.

Maybe, but I was alluding to that with my .html example...so there!

>I guess no further explaination is needed required for the OP's initial requirement.

Maybe you can understand gibberish kiddo... :rolleyes:

>You can't change the font size written in to the text file

Of course you can, not from the c program of course, but you do so from notepad directly. It's just that the entire file will be that size. I think that's all he wants. Just for it to fit into an A4 sheet or something so he can print it off from the printer?

Hah. That doesnt change the font size in the text file. Because the text file does not have a font size. You are only changing the font size of the viewer program. What you are saying is like, looking at a paper through a magnifying glass and saying that the font size of the paper has got bigger.

>I guess no further explaination is needed required for the OP's initial requirement.

Maybe you can understand gibberish kiddo... :rolleyes:

Maybe you can't understand the answers given to your own questions.

Member Avatar for iamthwee

[satire]
>Hah. That doesnt change the font size in the text file. Because the text file does not have a font size. You are only changing the font size of the viewer program.

Oh wow, let's all be pedantic!

>Maybe you can't understand the answers given to your own questions.

Like I said, you can understand gibberish, well done!

>Hah. That doesnt change the font size in the text file. Because the text file does not have a font size. You are only changing the font size of the viewer program.

Oh wow, let's all be pedantic!

That is just running away without an explaination, and off topic, and maybe just serves to increase youarethwee's :rolleyes: post count.

Member Avatar for iamthwee

Ha ha I sorrie, you're right wolfy wolfy.

You missed my hidden messages. I looooooooooove you really man!

God bless.

Ha ha I sorrie, you're right wolfy wolfy.

You missed my hidden messages. I looooooooooove you really man!

God bless.

You and your hidden messages:cheesy:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.