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.

PDFCIDFontDescriptor.java 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * Copyright 1999-2004 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /* $Id$ */
  17. package org.apache.fop.pdf;
  18. // based on work by Takayuki Takeuchi
  19. /**
  20. * class representing a font descriptor for CID fonts.
  21. *
  22. * Font descriptors for CID fonts are specified on page 227 and onwards of the PDF 1.3 spec.
  23. */
  24. public class PDFCIDFontDescriptor extends PDFFontDescriptor {
  25. /**
  26. * The language for the font
  27. */
  28. protected String lang;
  29. /**
  30. * The cid set stream
  31. */
  32. protected PDFStream cidSet;
  33. /**
  34. * create the /FontDescriptor object
  35. *
  36. * @param basefont the base font name
  37. * @param fontBBox the bounding box for the described font
  38. * @param flags various characteristics of the font
  39. * @param capHeight height of the capital letters
  40. * @param stemV the width of the dominant vertical stems of glyphs
  41. * @param italicAngle the angle of the vertical dominant strokes
  42. * @param lang the language
  43. */
  44. public PDFCIDFontDescriptor(String basefont, int[] fontBBox,
  45. int capHeight, int flags, int italicAngle,
  46. int stemV, String lang) {
  47. super(basefont, fontBBox[3], fontBBox[1], capHeight, flags,
  48. new PDFRectangle(fontBBox), italicAngle, stemV);
  49. this.lang = lang;
  50. }
  51. /**
  52. * Set the CID set stream.
  53. * @param cidSet the pdf stream cotnaining the CID set
  54. */
  55. public void setCIDSet(PDFStream cidSet) {
  56. this.cidSet = cidSet;
  57. }
  58. /**
  59. * Fill in the pdf data for this font descriptor.
  60. * The charset specific dictionary entries are output.
  61. * @param p the string buffer to append the data
  62. */
  63. protected void fillInPDF(StringBuffer p) {
  64. p.append("\n/MissingWidth 500\n");
  65. if (lang != null) {
  66. p.append("\n/Lang /");
  67. p.append(lang);
  68. }
  69. if (cidSet != null) {
  70. p.append("\n/CIDSet /");
  71. p.append(this.cidSet.referencePDF());
  72. }
  73. }
  74. }