You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RtfFontManager.java 4.8KB

Merged revisions 682600,682604-682605,682616-682618,682625,682630,683136,683159,683684,684041,684491,684493,684575,684577 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ................ r682600 | jeremias | 2008-08-05 07:46:31 +0100 (Tue, 05 Aug 2008) | 8 lines Blocked revisions 681371 via svnmerge ........ r681371 | jeremias | 2008-07-31 15:54:16 +0200 (Do, 31 Jul 2008) | 1 line Adjust fop.bat to JAR upgrade. ........ ................ r682604 | jeremias | 2008-08-05 07:51:32 +0100 (Tue, 05 Aug 2008) | 26 lines Merged revisions 636407-637074,637076-637118,637120-637790,637792-637856,637858-637992,637994-638047,638049-638307,638309-638315,638318-638936,638938-640888,640890-642905,642907-647402,647404-647536,647538-648983,648985-649005,649007-649013,649015-650549,650551-651301,651303-653536,653538-654452,654454-656285,656287-656523,656525-657519,657521-661579,661581-663481,663483-664691,664693-666634,666636-666661,666663-668532,668535-668549,668551-668569,668571-668640,668642-669117,669119-669172,669174-669477,669479-670550,670552-673749,673751-674303,674305-674313,674315-674316,674318-675105,675107-675149,675153-675706,675708-680714,680716-680819,680821-681283,681285,681287-681289,681293-681370,681372-682601 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_95 ........ r681309 | jeremias | 2008-07-31 11:31:35 +0200 (Do, 31 Jul 2008) | 2 lines 0.95beta -> 0.95 Added links to the new SVN mirror in the Netherlands. ........ r681314 | vhennebert | 2008-07-31 11:41:33 +0200 (Do, 31 Jul 2008) | 2 lines Corrected bug number ........ r681329 | vhennebert | 2008-07-31 12:38:10 +0200 (Do, 31 Jul 2008) | 2 lines Slight re-phrasing to make it clearer (I believe) that this page only lists changes made since 0.95beta, but that changes from that latter are of course also available in 0.95 final ........ r681330 | vhennebert | 2008-07-31 12:39:50 +0200 (Do, 31 Jul 2008) | 2 lines Don't be shy Max ;-) Restored alphabetical order in the list of active committers ........ r681350 | jeremias | 2008-07-31 14:09:41 +0200 (Do, 31 Jul 2008) | 1 line Fixed validation errors. ........ ................ r682605 | jeremias | 2008-08-05 07:55:12 +0100 (Tue, 05 Aug 2008) | 3 lines Removed merge tracking for "svnmerge" for https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_95 ................ r682616 | jeremias | 2008-08-05 08:46:14 +0100 (Tue, 05 Aug 2008) | 1 line Skip IO Exception when loading a PFM and an AFM could be loaded. The PFM is only a fallback and not necessary when the AFM is available. Motivation: The "URW Bookman L" fonts from GhostScript have bad PFM files. ................ r682617 | jeremias | 2008-08-05 08:47:18 +0100 (Tue, 05 Aug 2008) | 1 line The FontEventListener was not wired into font auto-detection. An error while loading a font wasn't relayed to the event subsystem. ................ r682618 | jeremias | 2008-08-05 08:57:36 +0100 (Tue, 05 Aug 2008) | 1 line Fixed small mistake with weight adjustment on font lookup. Weight 400 was slipping through the cracks. ................ r682625 | jeremias | 2008-08-05 09:12:25 +0100 (Tue, 05 Aug 2008) | 2 lines Removed "Areas of expertise" as discussed. News update for 0.95 release. ................ r682630 | jeremias | 2008-08-05 09:28:07 +0100 (Tue, 05 Aug 2008) | 1 line Oopsy, that wasn't intended to get into trunk. ................ r683136 | jeremias | 2008-08-06 07:49:36 +0100 (Wed, 06 Aug 2008) | 1 line Some missing release info. ................ r683159 | jeremias | 2008-08-06 09:24:53 +0100 (Wed, 06 Aug 2008) | 1 line Converted the project news to a special XML format so I can generate an RSS feed. Mostly copied from XML Graphics Commons. ................ r683684 | jeremias | 2008-08-07 20:26:54 +0100 (Thu, 07 Aug 2008) | 1 line Added fop.cmd to binary distribution (not sure if any of the others should be included, too) ................ r684041 | spepping | 2008-08-08 19:38:07 +0100 (Fri, 08 Aug 2008) | 2 lines Added fop.js to binary distribution ................ r684491 | adelmelle | 2008-08-10 13:35:42 +0100 (Sun, 10 Aug 2008) | 1 line Bugzilla 45490: Avoid altering the original 'href' if the protocol is other than 'file:' (suggested by Thomas Stieler) ................ r684493 | adelmelle | 2008-08-10 13:40:58 +0100 (Sun, 10 Aug 2008) | 1 line Added 'due-to' to the wrong entry... ................ r684575 | jeremias | 2008-08-10 20:18:22 +0100 (Sun, 10 Aug 2008) | 2 lines Merge from 0_95 branch: Fixed ID resolution for nested bookmarks with duplicated IDs. ................ r684577 | jeremias | 2008-08-10 20:35:27 +0100 (Sun, 10 Aug 2008) | 3 lines Bugzilla #45606: Fixed generation of "fonttbl" for RTF output to fix loading problem with AbiWord. Submitted by: Pavel Kysilka <goldenfish.at.linuxsoft.cz> ................ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@685487 13f79535-47bb-0310-9956-ffa450edef68
16 years ago
Merged revisions 682600,682604-682605,682616-682618,682625,682630,683136,683159,683684,684041,684491,684493,684575,684577 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ................ r682600 | jeremias | 2008-08-05 07:46:31 +0100 (Tue, 05 Aug 2008) | 8 lines Blocked revisions 681371 via svnmerge ........ r681371 | jeremias | 2008-07-31 15:54:16 +0200 (Do, 31 Jul 2008) | 1 line Adjust fop.bat to JAR upgrade. ........ ................ r682604 | jeremias | 2008-08-05 07:51:32 +0100 (Tue, 05 Aug 2008) | 26 lines Merged revisions 636407-637074,637076-637118,637120-637790,637792-637856,637858-637992,637994-638047,638049-638307,638309-638315,638318-638936,638938-640888,640890-642905,642907-647402,647404-647536,647538-648983,648985-649005,649007-649013,649015-650549,650551-651301,651303-653536,653538-654452,654454-656285,656287-656523,656525-657519,657521-661579,661581-663481,663483-664691,664693-666634,666636-666661,666663-668532,668535-668549,668551-668569,668571-668640,668642-669117,669119-669172,669174-669477,669479-670550,670552-673749,673751-674303,674305-674313,674315-674316,674318-675105,675107-675149,675153-675706,675708-680714,680716-680819,680821-681283,681285,681287-681289,681293-681370,681372-682601 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_95 ........ r681309 | jeremias | 2008-07-31 11:31:35 +0200 (Do, 31 Jul 2008) | 2 lines 0.95beta -> 0.95 Added links to the new SVN mirror in the Netherlands. ........ r681314 | vhennebert | 2008-07-31 11:41:33 +0200 (Do, 31 Jul 2008) | 2 lines Corrected bug number ........ r681329 | vhennebert | 2008-07-31 12:38:10 +0200 (Do, 31 Jul 2008) | 2 lines Slight re-phrasing to make it clearer (I believe) that this page only lists changes made since 0.95beta, but that changes from that latter are of course also available in 0.95 final ........ r681330 | vhennebert | 2008-07-31 12:39:50 +0200 (Do, 31 Jul 2008) | 2 lines Don't be shy Max ;-) Restored alphabetical order in the list of active committers ........ r681350 | jeremias | 2008-07-31 14:09:41 +0200 (Do, 31 Jul 2008) | 1 line Fixed validation errors. ........ ................ r682605 | jeremias | 2008-08-05 07:55:12 +0100 (Tue, 05 Aug 2008) | 3 lines Removed merge tracking for "svnmerge" for https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_95 ................ r682616 | jeremias | 2008-08-05 08:46:14 +0100 (Tue, 05 Aug 2008) | 1 line Skip IO Exception when loading a PFM and an AFM could be loaded. The PFM is only a fallback and not necessary when the AFM is available. Motivation: The "URW Bookman L" fonts from GhostScript have bad PFM files. ................ r682617 | jeremias | 2008-08-05 08:47:18 +0100 (Tue, 05 Aug 2008) | 1 line The FontEventListener was not wired into font auto-detection. An error while loading a font wasn't relayed to the event subsystem. ................ r682618 | jeremias | 2008-08-05 08:57:36 +0100 (Tue, 05 Aug 2008) | 1 line Fixed small mistake with weight adjustment on font lookup. Weight 400 was slipping through the cracks. ................ r682625 | jeremias | 2008-08-05 09:12:25 +0100 (Tue, 05 Aug 2008) | 2 lines Removed "Areas of expertise" as discussed. News update for 0.95 release. ................ r682630 | jeremias | 2008-08-05 09:28:07 +0100 (Tue, 05 Aug 2008) | 1 line Oopsy, that wasn't intended to get into trunk. ................ r683136 | jeremias | 2008-08-06 07:49:36 +0100 (Wed, 06 Aug 2008) | 1 line Some missing release info. ................ r683159 | jeremias | 2008-08-06 09:24:53 +0100 (Wed, 06 Aug 2008) | 1 line Converted the project news to a special XML format so I can generate an RSS feed. Mostly copied from XML Graphics Commons. ................ r683684 | jeremias | 2008-08-07 20:26:54 +0100 (Thu, 07 Aug 2008) | 1 line Added fop.cmd to binary distribution (not sure if any of the others should be included, too) ................ r684041 | spepping | 2008-08-08 19:38:07 +0100 (Fri, 08 Aug 2008) | 2 lines Added fop.js to binary distribution ................ r684491 | adelmelle | 2008-08-10 13:35:42 +0100 (Sun, 10 Aug 2008) | 1 line Bugzilla 45490: Avoid altering the original 'href' if the protocol is other than 'file:' (suggested by Thomas Stieler) ................ r684493 | adelmelle | 2008-08-10 13:40:58 +0100 (Sun, 10 Aug 2008) | 1 line Added 'due-to' to the wrong entry... ................ r684575 | jeremias | 2008-08-10 20:18:22 +0100 (Sun, 10 Aug 2008) | 2 lines Merge from 0_95 branch: Fixed ID resolution for nested bookmarks with duplicated IDs. ................ r684577 | jeremias | 2008-08-10 20:35:27 +0100 (Sun, 10 Aug 2008) | 3 lines Bugzilla #45606: Fixed generation of "fonttbl" for RTF output to fix loading problem with AbiWord. Submitted by: Pavel Kysilka <goldenfish.at.linuxsoft.cz> ................ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@685487 13f79535-47bb-0310-9956-ffa450edef68
16 years ago
Merged revisions 682600,682604-682605,682616-682618,682625,682630,683136,683159,683684,684041,684491,684493,684575,684577 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ................ r682600 | jeremias | 2008-08-05 07:46:31 +0100 (Tue, 05 Aug 2008) | 8 lines Blocked revisions 681371 via svnmerge ........ r681371 | jeremias | 2008-07-31 15:54:16 +0200 (Do, 31 Jul 2008) | 1 line Adjust fop.bat to JAR upgrade. ........ ................ r682604 | jeremias | 2008-08-05 07:51:32 +0100 (Tue, 05 Aug 2008) | 26 lines Merged revisions 636407-637074,637076-637118,637120-637790,637792-637856,637858-637992,637994-638047,638049-638307,638309-638315,638318-638936,638938-640888,640890-642905,642907-647402,647404-647536,647538-648983,648985-649005,649007-649013,649015-650549,650551-651301,651303-653536,653538-654452,654454-656285,656287-656523,656525-657519,657521-661579,661581-663481,663483-664691,664693-666634,666636-666661,666663-668532,668535-668549,668551-668569,668571-668640,668642-669117,669119-669172,669174-669477,669479-670550,670552-673749,673751-674303,674305-674313,674315-674316,674318-675105,675107-675149,675153-675706,675708-680714,680716-680819,680821-681283,681285,681287-681289,681293-681370,681372-682601 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_95 ........ r681309 | jeremias | 2008-07-31 11:31:35 +0200 (Do, 31 Jul 2008) | 2 lines 0.95beta -> 0.95 Added links to the new SVN mirror in the Netherlands. ........ r681314 | vhennebert | 2008-07-31 11:41:33 +0200 (Do, 31 Jul 2008) | 2 lines Corrected bug number ........ r681329 | vhennebert | 2008-07-31 12:38:10 +0200 (Do, 31 Jul 2008) | 2 lines Slight re-phrasing to make it clearer (I believe) that this page only lists changes made since 0.95beta, but that changes from that latter are of course also available in 0.95 final ........ r681330 | vhennebert | 2008-07-31 12:39:50 +0200 (Do, 31 Jul 2008) | 2 lines Don't be shy Max ;-) Restored alphabetical order in the list of active committers ........ r681350 | jeremias | 2008-07-31 14:09:41 +0200 (Do, 31 Jul 2008) | 1 line Fixed validation errors. ........ ................ r682605 | jeremias | 2008-08-05 07:55:12 +0100 (Tue, 05 Aug 2008) | 3 lines Removed merge tracking for "svnmerge" for https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_95 ................ r682616 | jeremias | 2008-08-05 08:46:14 +0100 (Tue, 05 Aug 2008) | 1 line Skip IO Exception when loading a PFM and an AFM could be loaded. The PFM is only a fallback and not necessary when the AFM is available. Motivation: The "URW Bookman L" fonts from GhostScript have bad PFM files. ................ r682617 | jeremias | 2008-08-05 08:47:18 +0100 (Tue, 05 Aug 2008) | 1 line The FontEventListener was not wired into font auto-detection. An error while loading a font wasn't relayed to the event subsystem. ................ r682618 | jeremias | 2008-08-05 08:57:36 +0100 (Tue, 05 Aug 2008) | 1 line Fixed small mistake with weight adjustment on font lookup. Weight 400 was slipping through the cracks. ................ r682625 | jeremias | 2008-08-05 09:12:25 +0100 (Tue, 05 Aug 2008) | 2 lines Removed "Areas of expertise" as discussed. News update for 0.95 release. ................ r682630 | jeremias | 2008-08-05 09:28:07 +0100 (Tue, 05 Aug 2008) | 1 line Oopsy, that wasn't intended to get into trunk. ................ r683136 | jeremias | 2008-08-06 07:49:36 +0100 (Wed, 06 Aug 2008) | 1 line Some missing release info. ................ r683159 | jeremias | 2008-08-06 09:24:53 +0100 (Wed, 06 Aug 2008) | 1 line Converted the project news to a special XML format so I can generate an RSS feed. Mostly copied from XML Graphics Commons. ................ r683684 | jeremias | 2008-08-07 20:26:54 +0100 (Thu, 07 Aug 2008) | 1 line Added fop.cmd to binary distribution (not sure if any of the others should be included, too) ................ r684041 | spepping | 2008-08-08 19:38:07 +0100 (Fri, 08 Aug 2008) | 2 lines Added fop.js to binary distribution ................ r684491 | adelmelle | 2008-08-10 13:35:42 +0100 (Sun, 10 Aug 2008) | 1 line Bugzilla 45490: Avoid altering the original 'href' if the protocol is other than 'file:' (suggested by Thomas Stieler) ................ r684493 | adelmelle | 2008-08-10 13:40:58 +0100 (Sun, 10 Aug 2008) | 1 line Added 'due-to' to the wrong entry... ................ r684575 | jeremias | 2008-08-10 20:18:22 +0100 (Sun, 10 Aug 2008) | 2 lines Merge from 0_95 branch: Fixed ID resolution for nested bookmarks with duplicated IDs. ................ r684577 | jeremias | 2008-08-10 20:35:27 +0100 (Sun, 10 Aug 2008) | 3 lines Bugzilla #45606: Fixed generation of "fonttbl" for RTF output to fix loading problem with AbiWord. Submitted by: Pavel Kysilka <goldenfish.at.linuxsoft.cz> ................ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@685487 13f79535-47bb-0310-9956-ffa450edef68
16 years ago
Merged revisions 682600,682604-682605,682616-682618,682625,682630,683136,683159,683684,684041,684491,684493,684575,684577 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ................ r682600 | jeremias | 2008-08-05 07:46:31 +0100 (Tue, 05 Aug 2008) | 8 lines Blocked revisions 681371 via svnmerge ........ r681371 | jeremias | 2008-07-31 15:54:16 +0200 (Do, 31 Jul 2008) | 1 line Adjust fop.bat to JAR upgrade. ........ ................ r682604 | jeremias | 2008-08-05 07:51:32 +0100 (Tue, 05 Aug 2008) | 26 lines Merged revisions 636407-637074,637076-637118,637120-637790,637792-637856,637858-637992,637994-638047,638049-638307,638309-638315,638318-638936,638938-640888,640890-642905,642907-647402,647404-647536,647538-648983,648985-649005,649007-649013,649015-650549,650551-651301,651303-653536,653538-654452,654454-656285,656287-656523,656525-657519,657521-661579,661581-663481,663483-664691,664693-666634,666636-666661,666663-668532,668535-668549,668551-668569,668571-668640,668642-669117,669119-669172,669174-669477,669479-670550,670552-673749,673751-674303,674305-674313,674315-674316,674318-675105,675107-675149,675153-675706,675708-680714,680716-680819,680821-681283,681285,681287-681289,681293-681370,681372-682601 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_95 ........ r681309 | jeremias | 2008-07-31 11:31:35 +0200 (Do, 31 Jul 2008) | 2 lines 0.95beta -> 0.95 Added links to the new SVN mirror in the Netherlands. ........ r681314 | vhennebert | 2008-07-31 11:41:33 +0200 (Do, 31 Jul 2008) | 2 lines Corrected bug number ........ r681329 | vhennebert | 2008-07-31 12:38:10 +0200 (Do, 31 Jul 2008) | 2 lines Slight re-phrasing to make it clearer (I believe) that this page only lists changes made since 0.95beta, but that changes from that latter are of course also available in 0.95 final ........ r681330 | vhennebert | 2008-07-31 12:39:50 +0200 (Do, 31 Jul 2008) | 2 lines Don't be shy Max ;-) Restored alphabetical order in the list of active committers ........ r681350 | jeremias | 2008-07-31 14:09:41 +0200 (Do, 31 Jul 2008) | 1 line Fixed validation errors. ........ ................ r682605 | jeremias | 2008-08-05 07:55:12 +0100 (Tue, 05 Aug 2008) | 3 lines Removed merge tracking for "svnmerge" for https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_95 ................ r682616 | jeremias | 2008-08-05 08:46:14 +0100 (Tue, 05 Aug 2008) | 1 line Skip IO Exception when loading a PFM and an AFM could be loaded. The PFM is only a fallback and not necessary when the AFM is available. Motivation: The "URW Bookman L" fonts from GhostScript have bad PFM files. ................ r682617 | jeremias | 2008-08-05 08:47:18 +0100 (Tue, 05 Aug 2008) | 1 line The FontEventListener was not wired into font auto-detection. An error while loading a font wasn't relayed to the event subsystem. ................ r682618 | jeremias | 2008-08-05 08:57:36 +0100 (Tue, 05 Aug 2008) | 1 line Fixed small mistake with weight adjustment on font lookup. Weight 400 was slipping through the cracks. ................ r682625 | jeremias | 2008-08-05 09:12:25 +0100 (Tue, 05 Aug 2008) | 2 lines Removed "Areas of expertise" as discussed. News update for 0.95 release. ................ r682630 | jeremias | 2008-08-05 09:28:07 +0100 (Tue, 05 Aug 2008) | 1 line Oopsy, that wasn't intended to get into trunk. ................ r683136 | jeremias | 2008-08-06 07:49:36 +0100 (Wed, 06 Aug 2008) | 1 line Some missing release info. ................ r683159 | jeremias | 2008-08-06 09:24:53 +0100 (Wed, 06 Aug 2008) | 1 line Converted the project news to a special XML format so I can generate an RSS feed. Mostly copied from XML Graphics Commons. ................ r683684 | jeremias | 2008-08-07 20:26:54 +0100 (Thu, 07 Aug 2008) | 1 line Added fop.cmd to binary distribution (not sure if any of the others should be included, too) ................ r684041 | spepping | 2008-08-08 19:38:07 +0100 (Fri, 08 Aug 2008) | 2 lines Added fop.js to binary distribution ................ r684491 | adelmelle | 2008-08-10 13:35:42 +0100 (Sun, 10 Aug 2008) | 1 line Bugzilla 45490: Avoid altering the original 'href' if the protocol is other than 'file:' (suggested by Thomas Stieler) ................ r684493 | adelmelle | 2008-08-10 13:40:58 +0100 (Sun, 10 Aug 2008) | 1 line Added 'due-to' to the wrong entry... ................ r684575 | jeremias | 2008-08-10 20:18:22 +0100 (Sun, 10 Aug 2008) | 2 lines Merge from 0_95 branch: Fixed ID resolution for nested bookmarks with duplicated IDs. ................ r684577 | jeremias | 2008-08-10 20:35:27 +0100 (Sun, 10 Aug 2008) | 3 lines Bugzilla #45606: Fixed generation of "fonttbl" for RTF output to fix loading problem with AbiWord. Submitted by: Pavel Kysilka <goldenfish.at.linuxsoft.cz> ................ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@685487 13f79535-47bb-0310-9956-ffa450edef68
16 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /* $Id$ */
  18. package org.apache.fop.render.rtf.rtflib.rtfdoc;
  19. /*
  20. * This file is part of the RTF library of the FOP project, which was originally
  21. * created by Bertrand Delacretaz <bdelacretaz@codeconsult.ch> and by other
  22. * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to
  23. * the FOP project.
  24. */
  25. import java.io.IOException;
  26. import java.util.Hashtable;
  27. import java.util.Vector;
  28. /**
  29. * RTF font table
  30. * @author Andreas Putz a.putz@skynamics.com
  31. */
  32. public final class RtfFontManager {
  33. //////////////////////////////////////////////////
  34. // @@ Members
  35. //////////////////////////////////////////////////
  36. /** Singelton instance */
  37. private static RtfFontManager instance = null;
  38. /** Index table for the fonts */
  39. private Hashtable fontIndex = null;
  40. /** Used fonts to this vector */
  41. private Vector fontTable = null;
  42. //////////////////////////////////////////////////
  43. // @@ Construction
  44. //////////////////////////////////////////////////
  45. /**
  46. * Constructor.
  47. */
  48. private RtfFontManager () {
  49. fontTable = new Vector ();
  50. fontIndex = new Hashtable ();
  51. init ();
  52. }
  53. /**
  54. * Singelton.
  55. *
  56. * @return The instance of RtfFontManager
  57. */
  58. public static RtfFontManager getInstance () {
  59. if (instance == null) {
  60. instance = new RtfFontManager ();
  61. }
  62. return instance;
  63. }
  64. //////////////////////////////////////////////////
  65. // @@ Initializing
  66. //////////////////////////////////////////////////
  67. /**
  68. * Initialize the font table.
  69. */
  70. private void init () {
  71. // getFontNumber ("Helvetica");
  72. //Chanded by R.Marra default font Arial
  73. getFontNumber ("Arial");
  74. getFontNumber ("Symbol"); // used by RtfListItem.java
  75. getFontNumber ("Times New Roman");
  76. /*
  77. {\\f0\\fswiss Helv;}
  78. // f1 is used by RtfList and RtfListItem for bullets
  79. {\\f1\\froman\\fcharset2 Symbol;}
  80. {\\f2\\froman\\fprq2 Times New Roman;}
  81. {\\f3\\froman Times New Roman;}
  82. */
  83. }
  84. //////////////////////////////////////////////////
  85. // @@ Public methods
  86. //////////////////////////////////////////////////
  87. /**
  88. * Gets the number of font in the font table
  89. *
  90. * @param family Font family name ('Helvetica')
  91. *
  92. * @return The number of the font in the table
  93. */
  94. public int getFontNumber (String family) {
  95. Object o = fontIndex.get(getFontKey(family));
  96. int retVal;
  97. if (o == null) {
  98. addFont (family);
  99. retVal = fontTable.size() - 1;
  100. } else {
  101. retVal = ((Integer)o).intValue();
  102. }
  103. return retVal;
  104. }
  105. /**
  106. * Writes the font table in the header.
  107. *
  108. * @param header The header container to write in
  109. *
  110. * @throws IOException On error
  111. */
  112. public void writeFonts (RtfHeader header) throws IOException {
  113. if (fontTable == null || fontTable.size () == 0) {
  114. return;
  115. }
  116. header.newLine();
  117. header.writeGroupMark(true);
  118. header.writeControlWord("fonttbl");
  119. int len = fontTable.size ();
  120. for (int i = 0; i < len; i++) {
  121. header.writeGroupMark(true);
  122. header.newLine();
  123. header.write("\\f" + i);
  124. header.write(" " + (String) fontTable.elementAt (i));
  125. header.write(";");
  126. header.writeGroupMark(false);
  127. }
  128. header.newLine();
  129. header.writeGroupMark(false);
  130. }
  131. //////////////////////////////////////////////////
  132. // @@ Private methods
  133. //////////////////////////////////////////////////
  134. private String getFontKey(String family) {
  135. return family.toLowerCase();
  136. }
  137. /**
  138. * Adds a font to the table.
  139. *
  140. * @param family Identifier of font
  141. */
  142. private void addFont(String family) {
  143. fontIndex.put(getFontKey(family), new Integer(fontTable.size()));
  144. fontTable.addElement(family);
  145. }
  146. }