I am attempting to write a program that will generate .agr files that can be loaded and manipulated in xmgrace. I've dissected an example file that has the kind of formatting I'm looking for, but I'm not 100% sure what every line does. A lot of the commands are self-explanatory for the most part, but is there a guide somewhere I can use to reference some of the more obscure lines like #reference date 0, #default sformat "%.8g", #r0 off, etc.?
I've looked around the grace website in both the user and developer sections as well as googling individual lines without much luck. All I'm looking for is basically a man page of xmgrace .agr files. The more low-level details, the better.
Any help would be appreciated!
I'm sure that you have already looked through all of the official documentation for Grace/xmgrace. This documentation doesn't give much information about the internals of the .agr files that xmgrace creates.
I have found in the past that creating your own files and studying them in a text editor is a good way to learn what each line does, but as you said it is not always possible to decipher everything.
A project that is doing something similar to you is pygrace.
Maybe if you look at the pygrace source code it will give you some further clues to fill of the gaps in your existing knowledge.
Related
I know few about this and i'm trying to keep building upon it. My goal is to do image stacking with some criteria using C language, as i came upon some cool ideas i think i should be capable of doing with my photos. My C background should be enough to understand what i may need. That being said...
So far i've learned how to read an existing .TIFF file and save it into a char array. The problem is i don't know in which way its data is contained so that i can then be able to analize individual pixels and modify them, or build another .TIFF file from data i previously read.
I've read some things about (a so called) libtiff.h which may be usefull but i can't find where to get it, neither how to install it.
Does anyone know how a .TIFF file data is stored so that i can read it and apply changes to it?
Also,
Does anyone have any experience with handling image files and editing in C? Where did you learn it from?
Do you know of any place i could search for information/tutorials?
Any help will be very usefull,
Thanks in advance.
You can do an enormous amount of very sophisticated processing on TIFFs, or any one of 190+ other formats with ImageMagick without any need to understand TIFF format or write any C. Try searching on Stack Overflow for [imagemagick]
If you want to do processing yourself, consider https://cimg.eu
Another option might be to convert your TIFFs to NetPBM which is much, much simpler to read and write in C. That would be as follows with ImageMagick:
magick INPUT.TIFF -compress none OUTPUT.PPM
I have ahead of me a fairly specific task, and I was hoping someone on this site can give me the benefit of their experience
I have a text file somewhere with some 17000 lines of text. This text will need to be printed very specifically on around 80 double sided pages. These pages will then be cut into several pieces, and bound into small books (hey, it's a hobby!) This means I need to have text placed very specifically on the page. (I am also toying with the idea of having text cut off mid letter in one place and continued elsewhere)
Note that I have done this before, by manually placing text using a word processor. However, the sheer magnitude of this project really requires programming. I have thought about making some PNG files (which is easy enough to do), but I do not know how nicely they will look when printed. I have also briefly looked at some standard document file formats (like doc and pdf) and it looks like it'll take a long time before I can learn these last.
Does anyone happen to have any helpful tips, or at least know the best file format to use for such a project?
Thanks
The best recommendation I'd give is to use C to parse the input and generate a latex document, which is in turn used to generate a pdf for printing. Although it might seem more complicated, latex is much more flexible when it comes to typesetting placing manually the text in a bmp file for example (basically, latex is a language that consist of a set of rules to specify where and how a text should be printed).
Paul92 mentioned LaTex which is one option I'd consider. The learning curve can be quite steep but it will undoubtedly do a nice job with your text if you're willing to fuss with it.
If you're feeling a bit more 'rough and ready' you might consider markdown. It will keep the source text a bit more readable, and there are some reasonable options for getting from markdown to a nice print out.
In my quest to learn C (Plain C, not C#, nor C++. I have my reasons.), I have come across the need to extract some information from a HTML document, fetched from a URL. Namely, I want all href attributes from the links residing in a certain unordered list on the page, in an array of strings. These URLs point at images I want to download and store in a zip file.
Now, I've asked a few people I know are good at C, and they have either told me off with "C is the wrong tool", or pointed me at libXML, which is apparently famous for it's scarce documentation. I've also looked at libsoup and libtidy, but I can't seem to stitch the pieces together.
What approach/library should I pick? Does anyone know of some example code I could look at?
EDIT: Seeing that half the comments are telling me to use something other than C, I'll add that I'm not looking for the "right tool for the job". I'd probably use Ruby if I just wanted to get it done ASAP, simply because I'm comfortable with it. It's part of my quest to learn C, and as such, I'm looking for a pure C solution.
Since you are on a quest to learn C, then I would use the standard library and .
http://www.cplusplus.com/reference/clibrary/cstdio/
http://www.cplusplus.com/reference/clibrary/cstring/
The easiest is to use something else to get the page, write it to a local file, then pass the file name into your program. Print your output to STDOUT.
I want to read a ttf and draw a text with that font on a buffer. Even though there are libraries such as freetype, gd to do this task, I want to write my own code. Can you advice me on how to accomplish this task?
Unless you're one of the world's top experts on fonts, typography, and writing systems, the answer is simple: DON'T. TrueType/OpenType has a lot of tables you need to support for correct rendering, and even when using FreeType (which is an extremely low-level library), most people get it wrong.
If you need to do low-level, deterministic-across-platforms font handling, then at the very least, you should be using FreeType and libotf. This will provide you with access to the glyphs and outlines which you can then render however you like. In most cases though using your GUI system's text rendering routines will be a lot easier and less error-prone.
Finally, if you insist on ignoring my advice, a good RTFS on FreeType and Microsoft's online resources explaining the tables in TrueType/OpenType fonts are probably the best place to get started.
I would suggest you
Read all the TTF docs you can find
Find all the open source TTF parsers + renderers you can find, in many different languages, such as Freetype (c/c++), Batik (java), and anything else you can google for. Also George Williams' fontforge will likely be very helpful to you on your journey.
Rip apart all the programs you collected in 1. and see how they work. See if you can make a tiny small example program to do something simple, like dump the list of points for the outline of the letter "I".
Work on your rasterization. Start with something very simple, like rasterizing the letter "l".
The problem with TTF is that there is not a simple file format, and freetype handles a lot of crazy details for you. However if you don't care about portability, and you already have a specific TTF file you want to render, and you only care about a small simple alphabet, like Latin or Cyrillic, you might be OK.
Also you might want to check out a list of TTF documentation I linked to from my little project https://github.com/donbright/font_to_svg/
Not impossible, for anyone else tempted to try. I was curious about doing it because I like the DIY graphics approach where I allocate some memory and write into it, then save as a jpg or png. I pirated a bitmap font from giflib but that's strictly 8x8 pixels.
A few links:
`http://stevehanov.ca/blog/index.php?id=143`
`https://www.google.com/search?q=ttf+parser+c&ie=utf-8&oe=utf-8`
as R.. wrote the same time as i did in my comment, i would not to suggest to build another TTF-parser by your own. If you are eager to learn this very "spannende" field of Computer Science I would recommend "The Art of Computer Programming" Vol 2 from Donald E. Knuth. (it is Metafont, not TTF, but proven to be correct:-)
First of all I am very thankful to the owner of this website. I have learned and implement various technologies with the help of solutions provided by the readers.
I know the question I asked is posted many time in this forum. And I have tired all of the solutions available, but no luck
I may case I am trying to read a dat file which is basically a msg/feed file having more than 22000 Characters. Every line may or may not be of same length. My requirement is to convert the file to fixed line length character file. I have a logic that work well using vb script, however its pretty slow.
I have checked with For f/ but no luck. The only delimiter I have is EOT, which i can see in Textpad but not in notepad.
I have tried with \n, token=.
Please help me in resolving the issue.
Regards,
Rajiv
rajivbhati12#gmail.com
If VBScript was too slow, then a batch file will be even slower. What cmd is good at is running programs; as a programming environment – not so much. And string manipulation is certainly not its strong point (I have yet to learn whether you can actually manipulate arbitrary strings).
That being said, look at your algorithm, profile it, find out what makes it slow. Chances are that re-implementing it in another language won't make it much faster.