[File] [PATCH] Magdir/printer Hewlett-Packard Graphics Language *.hpgl *.hpg *.plt *.hp

Christos Zoulas christos at zoulas.com
Sun Dec 18 14:50:53 UTC 2022


Committed, thanks!

christos

> On Dec 15, 2022, at 9:27 PM, Jörg Jenderek <joerg.jen.der.ek at gmx.net> wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hello,
> 
> some weeks ago i update my inkscape graphic software. Just for
> interest i looked what file formats it now can open, export or import
> .
> 
> One listed extension is HPGL. So i looked for such samples.
> When running file command version 5.43 on such samples and related
> files i get an output like:
> 
> 286x192.5_lq.hpg:      data
> MyCD.hpgl:             ASCII text, with very long lines (4928)
> 		       , with no line terminators
> cdraw2020-plt.plt:     ASCII text, with CRLF line terminators
> charsize.hp:           data
> ci.hp:                 ASCII text
> corbusie.hpg:          ASCII text, with very long lines (65536)
> 		       , with no line terminators
> coreldraw2019-plt.plt: ASCII text, with CRLF line terminators
> ew.hpg:                ASCII text
> fill.plt:              data
> input.hpgl:            ASCII text, with very long lines (65536)
> 		       , with no line terminators
> miter.hp:              ASCII text
> pw.hpg:                ASCII text
> test.hpgl:             data
> test1.hpgl:            ASCII text
> test3.hpgl:            data
> thick.hp:              ASCII text
> ul.hp:                 data
> win_1.hp:              data
> 
> With option --extension 3 byte sequence ??? is shown and with
> option -i only generic text/plain or application/octet-stream
> mime types are shown.
> 
> For comparison reason i run the file format identification utility
> TrID ( See https://mark0.net/soft-trid-e.html). This identifies
> one third of my examples as "Hewlett-Packard Graphics Language" by
> hpg.trid.xml. But one third of my examples ( like  charsize.hp ci.hp
> fill.plt pw.hpg test1.hpgl win_1.hp) are not described. And some
> examples ( like 286x192.5_lq.hpg ew.hpg thick.hp ul.hp) starting with
> upcase letter B or P are described wrong as "PrintFox/Pagefox bitmap"
> by bitmap-printfox-p.trid.xml or bitmap-printfox-s.trid.xml. One
> example test3.hpgl is described wrong as "Spectrum emulator snapshot"
> by sp-spectrum.trid.xml. TrID mentions only 2 suffix (HPGL/HPG) and a
> user defined mime type vector/x-hpgl. For "Hewlett-Packard Graphics
> Language 2" it mention only 4 suffix (GL2/HPG2/PLT/SPL) and mime type
> application/vnd.hp-HPGL (See appended trid-v-hpgl.txt.gz).
> 
> For comparison reason i also run the file format identification
> utility DROID ( See https://sourceforge.net/projects/droid/). The
> PLT samples are described as "Hewlett Packard Vector Graphic Plotter
> File" by PUID x-fmt/83. The HPGL samples are described as "Hewlett
> Packard Graphics" by PUID x-fmt/293. Here the official registered
> mime type application/vnd.hp-HPGL is shown (See appended
> droid-hpgl.csv.gz).
> 
> All samples can be viewed, converted or at least inspected by graphic
> tool Xnview (See appended nconvert-hpgl.txt.gz). This can be verified
> by command line like:
> 	nconvert -in hpgl -info *
> 
> Luckily with information given by other tools i also found page about
> HP-GL on Wikipedia and on file formats archive team. There i also
> find samples for download and suited software. That informations are
> now expressed by comment lines inside Magdir/printer like:
> # URL:		http://fileformats.archiveteam.org/wiki/HP-GL
> #		https://en.wikipedia.org/wiki/HPGL
> # Reference:	http://mark0.net/download/triddefs_xml.7z
> #		defs/h/hpg.trid.xml
> #		defs/h/hpgl2.trid.xml
> 
> Obviously the Hewlett-Packard Graphics have no unique magic pattern.
> So i put displaying part inside sub routine which starts with line
> like:
> 0	name			hpgl
>> 0	string	x		Hewlett-Packard Graphics Language
> !:mime	application/vnd.hp-HPGL
> !:ext	hpgl/hpg/hp/plt
> Instead of user defined mime type i use the official registered one,
> that is also used by DROID. According to documentation the samples
> contain TEXT with instructions for HP plotter. The documentation
> mention 4 suffix, but i do not found samples with HPL extension.
> But i found some examples with HP extensions.
> 
> So many samples are described by current magic as ASCII text and
> some samples are described as data because these contain
> Control-characters like ^C or escape sequences but normally not at
> the beginning. So for informational and control reason i show
> content at the beginning by lines like:
>> 0	string	x			\b, starting with "%-.54s"
>>> &0	ubyte	<0x0E
>>>> &0	string	>\r			with "%-.10s"
>>>> &0	ubyte	<0x0E
>>>>> &0	string	>\r			with "%-.10s"
> 
> For the samples described by TrID i get as starting line something
> like:
> "IN;PU;SP1;PU0,0;PD0,90;
> So if you are an HP graphic expert you see that this is a valid HPGL
> file, which starts with initialize plotting job instruction IN. In
> some examples (like MyCD.hpgl corbusie.hpg input.hpgl) indicated by
> phrase ", with no line terminators" all instructions apparently are
> written in one line. On the other hand in some examples (like
> cdraw2020-plt.plt coreldraw2019-plt.plt created by CorelDraw) every
> instruction is placed on an own line. Here also carriage return and
> line feed (indicated by phrase "with CRLF line terminators" are used
> as line separators whereas for other examples only line feed is used
> as line separator. So for the CorelDraw examples i get first only
> phrase 'starting with "IN;"'. So here only 3 characters are shown.
> According to recommendation 4 bytes should be used for recognition.
> Then of course for control reasons then 4 or more characters should
> be shown. So i show content of second line by the last constructs
> starting by phrase "with".
> 
> Now i can put parts together. For the samples recognized by TrID
> these start with initializing plot job instruction. So this looks lik
> e:
> 0	string	IN;
>> 0		use		hpgl
> The sample test3.hpgl start with select pen directive SP. So this is
> done by line like:
> 0	string	SP
>> 0		use		hpgl
> Then i add for samples (like iw.hp 286x192.5_lh.hpg
> 286x192.5_lq.hpg) lines like:
> 0	string	PS\040
>> 0		use		hpgl
> I do not know what this means, because i have not time to read whole
> specification and get part time HP plotter expert. Furthermore i use
> lower than 4 bytes for recognition. That is not nice but if there
> exist collisions with other samples than just more test lines must
> be added. So at the moment things works as expected.
> 
> For samples described as "2" variant like sample dt.plt which start
> with escape like string are now described by lines like:
> 0	string	\033%-1B		Hewlett-Packard Graphics Language 2
> !:mime	application/vnd.hp-HPGL
> !:ext	plt
>> 5	string	x			with "%-.10s"
> 
> After applying the above mentioned modifications by patch
> file-5.43-printer-hpgl.diff then most of my Hewlett-Packard
> Graphics samples are now detected and described. This now looks like:
> 
> 286x192.5_lq.hpg:      Hewlett-Packard Graphics Language,
> 		       starting with "PS 11440 7700"
> 		       with "IP 0 0 114"
> MyCD.hpgl:             Hewlett-Packard Graphics Language,
> 		       starting with "IN;PU;SP1;PU0,0;PD0,90;
> 		       PU2410,4820;PD2405,4819,2401,48"
> cdraw2020-plt.plt:     Hewlett-Packard Graphics Language,
> 		       starting with "IN;"
> 		       with "VS32,1;\01"
> charsize.hp:           Hewlett-Packard Graphics Language,
> 		       starting with "IP0,0,1000,1000;"
> 		       with "SR3.33333,"
> ci.hp:                 Hewlett-Packard Graphics Language,
> 		       starting with "CO Concentric circles
> 		       drawn with different linewidths;"
> 		       with "PU 500,500"
> corbusie.hpg:          Hewlett-Packard Graphics Language,
> 		       starting with "IN;SC;
> 		       IW-16820,-11880,16820,11880;
> 		       VS25;SP1;LT;PU;PA-76"
> coreldraw2019-plt.plt: Hewlett-Packard Graphics Language,
> 		       starting with "IN;"
> 		       with "VS32,1;\01"
> dt.plt:                Hewlett-Packard Graphics Language 2
> 		       with "BPINPS1117"
> ew.hpg:                Hewlett-Packard Graphics Language,
> 		       starting with "BP"
> 		       with "IN\012PS70"
> fill.plt:              Hewlett-Packard Graphics Language,
> 		       starting with "INPS20000,20000"
> 		       with "IW2000,200"
> input.hpgl:            Hewlett-Packard Graphics Language,
> 		       starting with "IN;SP1;CA7;PU3598,4271;
> 		       PD673,4271,673,7197,;PU3598,425"
> miter.hp:              Hewlett-Packard Graphics Language,
> 		       starting with "PA4000,3000;" with "
> 		       PW2;\012LA"
> pw.hpg:                Hewlett-Packard Graphics Language,
> 		       starting with "NP8;"
> 		       with "PW 0.13, 1"
> test.hpgl:             Hewlett-Packard Graphics Language,
> 		       starting with "IN;SP3;DI0,1;
> 		       SR0.70,1.90;SC0,800,0,576;PA;PU20,0;LBDSA"
> test1.hpgl:            Hewlett-Packard Graphics Language,
> 		       starting with "DF;IN;LT;PU1000,1000;
> 		       PD2000,1000,2000,2000,1000,2000,1"
> 		       with "PR-100,0,0"
> test3.hpgl:            Hewlett-Packard Graphics Language,
> 		       starting with "SP6;DI0,1;SR0.70,1.90;
> 		       SC0,800,0,576;PA;PU20,0;LBDSA 60"
> 		       with "SP3;SC-864"
> thick.hp:              Hewlett-Packard Graphics Language,
> 		       starting with "PS9600,7100"
> 		       with "LT-4,50,1\"
> ul.hp:                 Hewlett-Packard Graphics Language,
> 		       starting with "PS4600,2100"
> 		       with "IP0,0,4600"
> win_1.hp:              data
> 
> With best wishes,
> 
> Jörg Jenderek
> - --
> Jörg Jenderek
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -----BEGIN PGP SIGNATURE-----
> Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
> 
> iF0EARECAB0WIQS5/qNWKD4ASGOJGL+v8rHJQhrU1gUCY5vXhAAKCRCv8rHJQhrU
> 1r/AAKDJlTdvRRjqUpI7HG5YB1eHIqJGRgCffkGVtgl5b24GQIDoAQALv90B7Fw=
> =HzWC
> -----END PGP SIGNATURE-----
> <droid-hpgl.csv.gz><trid-v-hpgl.txt.gz><file-5_43-printer-hpgl_diff.DEFANGED-10><file-5_43-printer-hpgl_diff_sig.DEFANGED-11><nconvert-hpgl.txt.gz>--
> File mailing list
> File at astron.com
> https://mailman.astron.com/mailman/listinfo/file
> <sanitizer.log>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <https://mailman.astron.com/pipermail/file/attachments/20221218/0de73509/attachment.asc>


More information about the File mailing list