XFontPeer.java 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. /* Copyright (C) 2000, 2002, 2003 Free Software Foundation
  2. This file is part of libgcj.
  3. This software is copyrighted work licensed under the terms of the
  4. Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
  5. details. */
  6. package gnu.awt.xlib;
  7. import java.awt.*;
  8. import gnu.java.awt.ClasspathToolkit;
  9. import gnu.java.awt.peer.ClasspathFontPeer;
  10. import java.util.Locale;
  11. import java.awt.font.*;
  12. import java.awt.geom.*;
  13. import java.text.CharacterIterator;
  14. /**
  15. * Classpath-compatible peer for a font
  16. */
  17. public class XFontPeer extends ClasspathFontPeer
  18. {
  19. public XFontPeer (String name, int style)
  20. {
  21. this (name, style, 12 /* kludge */);
  22. }
  23. public XFontPeer (String name, int style, float size)
  24. {
  25. super (name, style, (int)size);
  26. }
  27. /**
  28. * Implementation of {@link Font#canDisplay(char)}
  29. *
  30. * @param font the font this peer is being called from. This may be
  31. * useful if you are sharing peers between Font objects. Otherwise it may
  32. * be ignored.
  33. */
  34. public boolean canDisplay (Font font, int c)
  35. {
  36. throw new UnsupportedOperationException ();
  37. }
  38. /**
  39. * Implementation of {@link Font#canDisplay(String)},
  40. * {@link Font#canDisplay(char [], int, int)}, and
  41. * {@link Font#canDisplay(CharacterIterator, int, int)}.
  42. *
  43. * @param font the font this peer is being called from. This may be
  44. * useful if you are sharing peers between Font objects. Otherwise it may
  45. * be ignored.
  46. */
  47. public int canDisplayUpTo (Font font, CharacterIterator i, int start, int limit)
  48. {
  49. throw new UnsupportedOperationException ();
  50. }
  51. /**
  52. * Implementation of {@link
  53. * Font#createGlyphVector(FontRenderContext, String)}, {@link
  54. * Font#createGlyphVector(FontRenderContext, char[])}, and {@link
  55. * Font#createGlyphVector(FontRenderContext, CharacterIterator)}.
  56. *
  57. * @param font the font object that the created GlyphVector will return
  58. * when it gets asked for its font. This argument is needed because the
  59. * public API of {@link GlyphVector} works with {@link java.awt.Font},
  60. * not with font peers.
  61. */
  62. public GlyphVector createGlyphVector (Font font, FontRenderContext frc, CharacterIterator ci)
  63. {
  64. throw new UnsupportedOperationException ();
  65. }
  66. /**
  67. * Implementation of {@link Font#createGlyphVector(FontRenderContext,
  68. * int[])}.
  69. *
  70. * @param font the font object that the created GlyphVector will return
  71. * when it gets asked for its font. This argument is needed because the
  72. * public API of {@link GlyphVector} works with {@link java.awt.Font},
  73. * not with font peers.
  74. */
  75. public GlyphVector createGlyphVector (Font font, FontRenderContext ctx, int[] glyphCodes)
  76. {
  77. throw new UnsupportedOperationException ();
  78. }
  79. /**
  80. * Implementation of {@link Font#getBaselineFor(char)}
  81. *
  82. * @param font the font this peer is being called from. This may be
  83. * useful if you are sharing peers between Font objects. Otherwise it may
  84. * be ignored.
  85. */
  86. public byte getBaselineFor (Font font, char c)
  87. {
  88. throw new UnsupportedOperationException ();
  89. }
  90. /**
  91. * Implementation of {@link Font#getFontMetrics()}
  92. *
  93. * @param font the font this peer is being called from. This may be
  94. * useful if you are sharing peers between Font objects. Otherwise it may
  95. * be ignored.
  96. */
  97. public FontMetrics getFontMetrics (Font font)
  98. {
  99. throw new UnsupportedOperationException ();
  100. }
  101. /** Returns a name for the specified glyph. This is useful for
  102. * generating PostScript or PDF files that embed some glyphs of a
  103. * font. If the implementation follows glyph naming conventions
  104. * specified by Adobe, search engines can extract the original text
  105. * from the generated PostScript and PDF files.
  106. *
  107. * <p>This method is currently not used by GNU Classpath. However,
  108. * it would be very useful for someone wishing to write a good
  109. * PostScript or PDF stream provider for the
  110. * <code>javax.print</code> package.
  111. *
  112. * <p><b>Names are not unique:</b> Under some rare circumstances,
  113. * the same name can be returned for different glyphs. It is
  114. * therefore recommended that printer drivers check whether the same
  115. * name has already been returned for antoher glyph, and make the
  116. * name unique by adding the string ".alt" followed by the glyph
  117. * index.</p>
  118. *
  119. * <p>This situation would occur for an OpenType or TrueType font
  120. * that has a <code>post</code> table of format 3 and provides a
  121. * mapping from glyph IDs to Unicode sequences through a
  122. * <code>Zapf</code> table. If the same sequence of Unicode
  123. * codepoints leads to different glyphs (depending on contextual
  124. * position, for example, or on typographic sophistication level),
  125. * the same name would get synthesized for those glyphs. To avoid
  126. * this, the font peer would have to go through the names of all
  127. * glyphs, which would make this operation very inefficient with
  128. * large fonts.
  129. *
  130. * @param font the font containing the glyph whose name is
  131. * requested.
  132. *
  133. * @param glyphIndex the glyph whose name the caller wants to
  134. * retrieve.
  135. *
  136. * @return the glyph name, or <code>null</code> if a font does not
  137. * provide glyph names.
  138. */
  139. public String getGlyphName (Font font, int glyphIndex)
  140. {
  141. throw new UnsupportedOperationException ();
  142. }
  143. /**
  144. * Implementation of {@link Font#getLineMetrics(CharacterIterator, int,
  145. * int, FontRenderContext)}
  146. *
  147. * @param font the font this peer is being called from. This may be
  148. * useful if you are sharing peers between Font objects. Otherwise it may
  149. * be ignored.
  150. */
  151. public LineMetrics getLineMetrics (Font font, CharacterIterator ci, int begin, int limit, FontRenderContext rc)
  152. {
  153. throw new UnsupportedOperationException ();
  154. }
  155. /**
  156. * Implementation of {@link Font#getMaxCharBounds(FontRenderContext)}
  157. *
  158. * @param font the font this peer is being called from. This may be
  159. * useful if you are sharing peers between Font objects. Otherwise it may
  160. * be ignored.
  161. */
  162. public Rectangle2D getMaxCharBounds (Font font, FontRenderContext rc)
  163. {
  164. throw new UnsupportedOperationException ();
  165. }
  166. /**
  167. * Implementation of {@link Font#getMissingGlyphCode()}
  168. *
  169. * @param font the font this peer is being called from. This may be
  170. * useful if you are sharing peers between Font objects. Otherwise it may
  171. * be ignored.
  172. */
  173. public int getMissingGlyphCode (Font font)
  174. {
  175. throw new UnsupportedOperationException ();
  176. }
  177. /**
  178. * Implementation of {@link Font#getNumGlyphs()}
  179. *
  180. * @param font the font this peer is being called from. This may be
  181. * useful if you are sharing peers between Font objects. Otherwise it may
  182. * be ignored.
  183. */
  184. public int getNumGlyphs (Font font)
  185. {
  186. throw new UnsupportedOperationException ();
  187. }
  188. /**
  189. * Implementation of {@link Font#getPSName()}
  190. *
  191. * @param font the font this peer is being called from. This may be
  192. * useful if you are sharing peers between Font objects. Otherwise it may
  193. * be ignored.
  194. */
  195. public String getPostScriptName (Font font)
  196. {
  197. throw new UnsupportedOperationException ();
  198. }
  199. /**
  200. * Implementation of {@link Font#getStringBounds(CharacterIterator, int,
  201. * int, FontRenderContext)}
  202. *
  203. * @param font the font this peer is being called from. This may be
  204. * useful if you are sharing peers between Font objects. Otherwise it may
  205. * be ignored.
  206. */
  207. public Rectangle2D getStringBounds (Font font, CharacterIterator ci, int begin, int limit, FontRenderContext frc)
  208. {
  209. throw new UnsupportedOperationException ();
  210. }
  211. /** Returns the name of this font face inside the family, for example
  212. * <i>&#x201c;Light&#x201d;</i>.
  213. *
  214. * <p>This method is currently not used by {@link Font}. However,
  215. * this name would be needed by any serious desktop publishing
  216. * application.
  217. *
  218. * @param font the font whose sub-family name is requested.
  219. *
  220. * @param locale the locale for which to localize the name. If
  221. * <code>locale</code> is <code>null</code>, the returned name is
  222. * localized to the user&#x2019;s default locale.
  223. *
  224. * @return the name of the face inside its family, or
  225. * <code>null</code> if the font does not provide a sub-family name.
  226. */
  227. public String getSubFamilyName (Font font, Locale locale)
  228. {
  229. throw new UnsupportedOperationException ();
  230. }
  231. /**
  232. * Implementation of {@link Font#hasUniformLineMetrics()}
  233. *
  234. * @param font the font this peer is being called from. This may be
  235. * useful if you are sharing peers between Font objects. Otherwise it may
  236. * be ignored.
  237. */
  238. public boolean hasUniformLineMetrics (Font font)
  239. {
  240. throw new UnsupportedOperationException ();
  241. }
  242. /**
  243. * Implementation of {@link Font#layoutGlyphVector(FontRenderContext,
  244. * char[], int, int, int)}.
  245. *
  246. * @param font the font object that the created GlyphVector will return
  247. * when it gets asked for its font. This argument is needed because the
  248. * public API of {@link GlyphVector} works with {@link java.awt.Font},
  249. * not with font peers.
  250. */
  251. public GlyphVector layoutGlyphVector (Font font, FontRenderContext frc, char[] chars, int start, int limit, int flags)
  252. {
  253. throw new UnsupportedOperationException ();
  254. }
  255. }