Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

PDFFontType0.java 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*-- $Id$ --
  2. ============================================================================
  3. The Apache Software License, Version 1.1
  4. ============================================================================
  5. Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
  6. Redistribution and use in source and binary forms, with or without modifica-
  7. tion, are permitted provided that the following conditions are met:
  8. 1. Redistributions of source code must retain the above copyright notice,
  9. this list of conditions and the following disclaimer.
  10. 2. Redistributions in binary form must reproduce the above copyright notice,
  11. this list of conditions and the following disclaimer in the documentation
  12. and/or other materials provided with the distribution.
  13. 3. The end-user documentation included with the redistribution, if any, must
  14. include the following acknowledgment: "This product includes software
  15. developed by the Apache Software Foundation (http://www.apache.org/)."
  16. Alternately, this acknowledgment may appear in the software itself, if
  17. and wherever such third-party acknowledgments normally appear.
  18. 4. The names "Fop" and "Apache Software Foundation" must not be used to
  19. endorse or promote products derived from this software without prior
  20. written permission. For written permission, please contact
  21. apache@apache.org.
  22. 5. Products derived from this software may not be called "Apache", nor may
  23. "Apache" appear in their name, without prior written permission of the
  24. Apache Software Foundation.
  25. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  26. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  27. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  28. APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  29. INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
  30. DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  31. OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  32. ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  33. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  34. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  35. This software consists of voluntary contributions made by many individuals
  36. on behalf of the Apache Software Foundation and was originally created by
  37. James Tauber <jtauber@jtauber.com>. For more information on the Apache
  38. Software Foundation, please see <http://www.apache.org/>.
  39. */
  40. package org.apache.fop.pdf;
  41. /**
  42. * class representing a Type0 font.
  43. *
  44. * Type0 fonts are specified on page 208 and onwards of the PDF 1.3 spec.
  45. */
  46. public class PDFFontType0 extends PDFFontNonBase14 {
  47. /** this should be an array of CIDFont but only the first one is used */
  48. protected PDFCIDFont descendantFonts;
  49. protected PDFCMap cmap;
  50. /**
  51. * create the /Font object
  52. *
  53. * @param number the object's number
  54. * @param fontname the internal name for the font
  55. * @param subtype the font's subtype (PDFFont.TYPE0)
  56. * @param basefont the base font name
  57. * @param encoding the character encoding schema used by the font
  58. * @param mapping the Unicode mapping mechanism
  59. */
  60. public PDFFontType0(int number, String fontname, byte subtype,
  61. String basefont, Object encoding/*, PDFToUnicode mapping*/) {
  62. /* generic creation of PDF object */
  63. super(number, fontname, subtype, basefont, encoding/*, mapping*/);
  64. /* set fields using paramaters */
  65. this.descendantFonts = null;
  66. cmap=null;
  67. }
  68. /**
  69. * create the /Font object
  70. *
  71. * @param number the object's number
  72. * @param fontname the internal name for the font
  73. * @param subtype the font's subtype (PDFFont.TYPE0)
  74. * @param basefont the base font name
  75. * @param encoding the character encoding schema used by the font
  76. * @param mapping the Unicode mapping mechanism
  77. * @param descendantFonts the CIDFont upon which this font is based
  78. */
  79. public PDFFontType0(int number, String fontname, byte subtype,
  80. String basefont, Object encoding/*, PDFToUnicode mapping*/,
  81. PDFCIDFont descendantFonts) {
  82. /* generic creation of PDF object */
  83. super(number, fontname, subtype, basefont, encoding/*, mapping*/);
  84. /* set fields using paramaters */
  85. this.descendantFonts = descendantFonts;
  86. }
  87. /**
  88. * set the descendant font
  89. *
  90. * @param descendantFonts the CIDFont upon which this font is based
  91. */
  92. public void setDescendantFonts(PDFCIDFont descendantFonts) {
  93. this.descendantFonts = descendantFonts;
  94. }
  95. public void setCMAP(PDFCMap cmap) {
  96. this.cmap=cmap;
  97. }
  98. /**
  99. * fill in the specifics for the font's subtype
  100. */
  101. protected void fillInPDF(StringBuffer p) {
  102. if (descendantFonts != null) {
  103. p.append("\n/DescendantFonts [ " +
  104. this.descendantFonts.referencePDF() + " ] ");
  105. }
  106. if (cmap != null) {
  107. p.append("\n/ToUnicode "+cmap.referencePDF());
  108. }
  109. }
  110. }