Re: Experimenting in C code

Jose Da Silva <[email protected]> Fri, 3 Jun 2016 21:19:33 -0700
Newsgroups gmane.comp.fonts.fontforge.devel
Message-ID <[email protected]>
On June 3, 2016 03:48:14 PM you wrote:
> On Jun 2, 2016, at 3:43 AM, Jose Da Silva <[email protected]> wrote:
> > I'll assume you cloned fontforge/fontforge to your own github user
> > page, therefore making your copy "origin" and the fontforge/fontforge
> > "upstream"
> 
> Well, no, that’s not what I thought you said I should do. I don’t even 
know how to do that. You suggested that I start by installing from source.

Sorry about that - I misunderstood what you wrote.
Not a problem.

It's all about the code - not about the tools used - hehehe.
so...yes, install the source. compile the code, install to your computer.
Add some edits that you can see and verify later, recompile, and see if 
your newly modified fontforge compiled/installed with your new edits...

For example, create yourself an 8x8 monotone pixel drawing of the letter A, 
and save it as a.bmp, and resave it as a.pcx
in file gutils/gimagereadbmp.c, go to the last routine and modify it:

GImage *GImageReadBmp(char *filename) {
/* Import a BMP image, else cleanup and return NULL if error found */
    FILE *file, filepcx;			/* source file */
    GImage *ret;

    if ( (file=fopen(filename,"rb"))==NULL ) {
	fprintf(stderr,"Can't open \"%s\"\n", filename);
	return( NULL );
    }

    if ( (filepcx=fopen("~/a.pcx","rb"))==NULL ) {
	fprintf(stderr,"Can't open a.pcx\n");
	fclose(file);
	return( NULL );
    } else {
	fprintf(stderr,"found and opened a.pcx\n");
	fclose(filepcx);
	fprintf(stderr,"now closed a.pcx\n");
    }

    ret = GImageRead_Bmp(file);
    fclose(file);
    return( ret );
}
 
then restart the modified fontforge, new font, open a character window and 
go "import" file a.bmp  (I have not tested the code above, but assume it 
should also open, then close a.pcx if a.pcx is in the ~/ directory.


As mentioned earlier - satisfy yourself that you can compile the code, then 
the next step is tinkering with the code to make it better.
Your understanding of C, plus the fact you worked on something complex like 
accounting software, I'm guessing you'll find some stuff easy to understand.

and the easiest way to understand is to experiment around with something 
like a branch, and not the trunk....which was why I suggested something 
like try...adding pcx read/write capability.
You'll also note some routines in directory gutils are monotone, but there 
are a couple with potential for color or layers. I'd suggest try getting 
monotone working first, but also leave yourself some room to think of the 
possibility of adding colors or layers..... ...in future.





> On Jun 1, 2016, at 2:25 AM, you wrote:
> > Pick-up the latest FontForge source:
> > https://github.com/fontforge/fontforge
> 
> As far as I can tell, the “Clone or download” button on that page clones
> to my computer, not to my github user page (even when I’m logged in).
> The contributing page also goes there as the suggested first step. What
> I actually did was follow the instructions on the install page, which
> also cloned to my computer.
> 
> So I guess my "original" source is your “upstream,” with no “original”
> of my own on github. I’ll have to look at the config file you pointed
> me to, but I can’t do that now.

Sorry about bringing up confusion - just keep it simple, and we'll leave 
git and github for another day.

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
fontforge-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fontforge-devel
http://fontforge.10959.n7.nabble.com/Developer-f3.html