Home
Name Modified Size Downloads / Week Status
Totals: 4 Items   6.1 MB 5
fidoreadphp_manual_en.pdf 2012-05-20 433.5 kB 11 weekly downloads
README 2012-05-20 7.4 kB 22 weekly downloads
fidoreadphp_0_2_release_05202012.tbz2 2012-05-20 2.9 MB 11 weekly downloads
fidoreadphp_0_1_release_12192010.tbz2 2010-12-19 2.8 MB 11 weekly downloads
README file for FidoReadPHP Copyright 2010-2012 ---------------- 1 - Introduction ---------------- FidoCadJ is a very easy to use editor, with a vast library of electrical symbols and footprints (through hole and SMD). FidoCadJ is inspired from FidoCad (without "J"), which was a vector graphic editor useful for electrical schematics and printed circuit boards. FidoCadJ uses a file format containing only UTF-8 text, very compact and suited for copy and pasting from/into newsgroups and forum messages. This determined its success among the italian Usenet community, from late '90s, as it is quite versatile for simple mechanical drawings as well. First, a few useful sites about FidoCadJ: http://tinyurl.com/yavewp2 http://sourceforge.net/projects/fidocadj/ FidoReadPHP is meant to be a FidoCad/FidoCadJ file reader written in PHP easy to be integrated in forum engines in order to process on the fly FidoCadJ drawings. User can thus see the images generated by the server, but they can download the code describing it, modify it again with FidoCadJ and post it again. ----------------------------------------------- 2 - Files contained in this source distribution ----------------------------------------------- In the following table you can find a description of the trunk directory of the FidoReadPHP project. File Comments ---------------------------------------------------------------------------- README This file NEWS New stuff in the last versions icons/ Contains all icons (made with Gimp) src/ Contains all the PHP source files src/lib/ The FidoCadJ standard libraries src/fonts/liberation The open source Liberation fonts collection -------------------------------------- 3 - How to install and use FidoReadPHP -------------------------------------- 3.1 Install FidoReadPHP ----------------------- At first, we remind you that FidoReadPHP is a collection of PHP classes which should be used in a web page. They can parse a FidoCadJ drawing to obtain a standard PNG image which can be shown. To install FidoReadPHP in your system, you will need to place the FidoParser.php file somewhere where the PHP can reach it. You may find it in the src/ directory of this repository. All is somewhat self-contained, so all is done with a simple drag and drop. You will anyway need the FidoCadJ standard libraries, which are contained in those files: FCDstdlib_en.fcl as "" PCB_en.fcl as "pcb" IHRAM_en.fcl as "ihram" elettrotecnica_en.fcl as "elettrotecnica" You will also probably need some Free Type 2 fonts somewhere, if you want to take advantage of some advanced text rendering. Take note of where your system store those fonts and read the paragraph 3.2. 3.2 Using FidoReadPHP --------------------- The main interface of FidoReadPHP is the FidoParser class. Basically, what you need to do is to store the FidoCadJ drawing you want to plot in a string and then instanciate a FidoParser class, by passing to its constructor this string. Here is an example: require_once('FidoParser.php'); $fidoParser = new FidoParser(' [FIDOCAD] FJC B 0.5 LI 25 15 235 15 0 MC 25 25 0 0 115 TY 15 25 4 3 0 0 0 * R1 TY 15 30 4 3 0 0 0 * 1k MC 40 25 0 0 115 TY 31 25 4 3 0 0 0 * R2 TY 28 30 4 3 0 0 0 * 10k'); Now your class is instantiated, but to obtain the image you must first perform a certain number of operations. At first, we do have to load all the standard libraries, since FidoReadPHP does not do that by default: $standardLibraryString = file_get_contents('./lib/FCDstdlib_en.fcl', true); $fidoParser->readLibrary($standardLibraryString, ""); $pcbLibraryString = file_get_contents('./lib/PCB_en.fcl', true); $fidoParser->readLibrary($pcbLibraryString, "pcb"); $ihramLibraryString = file_get_contents('./lib/IHRAM_en.fcl', true); $fidoParser->readLibrary($ihramLibraryString, "ihram"); $ihramLibraryString = file_get_contents('./lib/elettrotecnica_en.fcl', true); $fidoParser->readLibrary($ihramLibraryString, "elettrotecnica"); We then specify where FidoReadPHP should find the fonts to be used for the drawing. Note that this operation is somewhat not mandatory, since the GD library exploited by FidoReadPHP contains some (ugly) bitmap fonts. The text rendering will be incomparably better, however, if a decent collection of fonts is available on your system: // We specify the path to the Free Type 2 fonts directory $fidoParser->setFontPath("/Library/Fonts/"); Remember to express the path to the directory in which you have your fonts stored and leave the path separator at the end, i.e. the '/' for Unices. This is mandatory, since this string is then concatenated with the font name to retrieve the file containing it. You will probably need at least the following fonts: Courier Times Helvetica Symbols Typically, what you might want to do is to specify some installed fonts for providing some sort of a standard set. The following code works with the Liberation font collection distributed with FidoReadPHP: $fidoParser->registerFont("Arial", "fonts/liberation/LiberationSans-Regular.ttf"); $fidoParser->registerFont("Helvetica", "fonts/liberation/LiberationSans-Regular.ttf"); $fidoParser->registerFont("Times", "fonts/liberation/LiberationSerif-Regular.ttf"); $fidoParser->registerFont("Times New Roman", "fonts/liberation/LiberationSerif-Regular.ttf"); $fidoParser->registerFont("Times Roman", "fonts/liberation/LiberationSerif-Regular.ttf"); $fidoParser->registerFont("Courier", "fonts/liberation/LiberationMono-Regular.ttf"); $fidoParser->registerFont("Courier New", "fonts/liberation/LiberationMono-Regular.ttf"); We now set up the zoom magnification factor (i.e. the number of pixels to be used for each logical unit) and we ask to FidoReadPHP to create the image for us. // We set up 2 pixels for each logical units and we ask FidoReadPHP to // calculate the size of the image. $fidoParser->setupSize(2, -1, -1); // We create the image $fidoParser->parse(); // We get the image $my_img = $fidoParser->getImage(); The member function setupSize requires the magnification factor as the first argument. The two following arguments are the wanted height or width of the image in pixels. If one of those two values is negative, FidoReadPHP will try to calculate automatically the size of the image to fit the given drawing. That is all. You may have a look at the index.php example file which is present in the src/ directory. It contains a rather minimal yet complete example. ---------------- 4 - Help wanted! ---------------- We are seeking for people interested to participate to the FidoReadPHP and FidoCadJ projects. If you want to do something, it is probably better to open a discussion in the SourceForge forums, in order that the work can eventually be shared and organized between all developers. Do not be afraid: all suggestion is very welcomed. Feel free to help us by reporting a bug or by suggesting a new feature. You may use the tools SourceForge offers to you: https://sourceforge.net/p/fidoreadphp/tickets/new/
Source: README, updated 2012-05-20