home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / modules / libfont / src / nf.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  5.7 KB  |  221 lines

  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18. /* 
  19.  *
  20.  * This contains definitions the are outside the scope of the interfaces
  21.  * defined that need to be exported out of the broker (libfont).
  22.  *
  23.  * dp Suresh <dp@netscape.com>
  24.  */
  25.  
  26.  
  27. #ifndef _nf_H_
  28. #define _nf_H_
  29.  
  30. #include "jritypes.h"
  31. #include "ntypes.h"
  32. #ifdef MOZILLA_CLIENT
  33. #include "client.h"
  34. #endif /* MOZILLA_CLIENT */
  35.  
  36. #ifdef __cplusplus
  37. #define NF_PUBLIC_API_DEFINE(returnType) extern "C" returnType
  38. #define NF_PUBLIC_API_IMPLEMENT(returnType) extern "C" returnType
  39. #else
  40. #define NF_PUBLIC_API_DEFINE(returnType) extern returnType
  41. #define NF_PUBLIC_API_IMPLEMENT(returnType) returnType
  42. #endif
  43.  
  44. /*
  45.  * Initialize routine for the FontBroker.
  46.  */
  47. NF_PUBLIC_API_DEFINE(struct nffbc *) NF_FontBrokerInitialize(void);
  48.  
  49. #ifdef MOZILLA_CLIENT
  50. /*
  51.  * Display about fonts in html
  52.  */
  53. NF_PUBLIC_API_DEFINE(char *) NF_AboutFonts(MWContext *context, const char *which);
  54. #endif /* MOZILLA_CLIENT */
  55.  
  56. /*
  57.  * Registering of font converters for font streaming
  58.  */
  59. NF_PUBLIC_API_DEFINE(void) NF_RegisterConverters(void);
  60.  
  61. #ifndef NO_PERFORMANCE_HACK
  62. /*
  63.  * For improving measure and draw performance.
  64.  */
  65. struct nfrc;
  66. struct rc_data;
  67. NF_PUBLIC_API_DEFINE(struct rc_data *) NF_GetRCNativeData(struct nfrc* rc);
  68. #endif /* NO_PERFORMANCE_HACK */
  69.  
  70. /*
  71.  * The native font displayer name. This is specific to netscape navigator.
  72.  */
  73. #define NF_NATIVE_FONT_DISPLAYER "Netscape Default Font Displayer"
  74.  
  75. /*
  76.  * Global variables that we create. These are the font broker
  77.  * interface variables that is available after font broker init.
  78.  */
  79. #ifdef __cplusplus
  80. extern "C" {
  81. #endif /* __cplusplus */
  82.     extern struct nffbc *WF_fbc;
  83.     extern struct nffbu *WF_fbu;
  84.     extern struct nffbp *WF_fbp;
  85. #ifdef __cplusplus
  86. }
  87. #endif /* __cplusplus */
  88.  
  89.  
  90. /* The bounding box of a string. We are using a structure instead of a JMC object
  91.  * because we expect this to be called a lot and returning a JMC object is going to be
  92.  * performance expensive.
  93.  */
  94. struct nf_bounding_box {
  95.     int width;
  96.     int ascent;
  97.     int descent;
  98.     int lbearing;
  99.     int rbearing;
  100. };
  101.  
  102. /*
  103.  * For faster drawing, we are exposing the rendering context data to the
  104.  * Displayer. Here are the definitions the Displayer will need to be able
  105.  * to do this.
  106.  */
  107.  
  108. /* Rendering context majorTypes. */
  109. #define NF_RC_INVALID 0
  110. #define NF_RC_DIRECT 1
  111. #define NF_RC_BUFFER 2
  112.  
  113. /* Rendering context minorTypes. 
  114.  * Valid minor types are
  115.  * any negative number : Rc's are always different.
  116.  * 0 (or) any positive number : Enable rc checking
  117.  */
  118. #define NF_RC_ALWAYS_DIFFERENT -1
  119.  
  120.  
  121. struct rc_direct {
  122. #if defined(XP_UNIX)
  123.   /* Display * */ void *display;
  124.   /* Drawable */ void *d;
  125.   /* GC */ void *gc;
  126.   jint    mask;
  127. #elif defined(XP_WIN)
  128.   /* DC */ void *dc;
  129. #elif defined(XP_OS2)
  130.   /* DC */ void *dc;
  131. #elif defined(XP_MAC)
  132.   /* CGragPtr */ void *port;
  133. #endif
  134. };
  135.  
  136. #if defined(XP_UNIX)
  137.    /* mask bit assignments */
  138. #define NF_DrawImageTextMask    (1<<0)
  139. #endif
  140.  
  141. struct rc_buffer {
  142.   /* IMPLEMENT_ME */
  143.   int implement_me;
  144. };
  145.  
  146. struct rc_data {
  147.   jint majorType;
  148.   jint minorType;
  149.   /* Displayers store state information here */
  150.   void *displayer_data;
  151.   union {
  152.     struct rc_direct directRc;
  153.     struct rc_buffer bufferRc;
  154.   } t;
  155. };
  156.  
  157. /*
  158.  * State values for NF_FONT
  159.  */
  160. #define NF_FONT_COMPLETE    1
  161. #define NF_FONT_INCOMPLETE    0
  162. #define NF_FONT_ERROR        -1
  163.  
  164. /* Font stream notification callback. */
  165. struct nff;    /* Forward declaration */
  166. #ifndef XP_OS2
  167. typedef void (*nfFontObserverCallback)(struct nff *, void *client_data);
  168. #else
  169. typedef void (* _Optlink nfFontObserverCallback)(struct nff *, void *client_data);
  170. #endif
  171.  
  172. /* Font stream: Maximum that can be returned from nfstrm::WriteReady() */
  173. #define NF_MAX_WRITE_READY 0X0FFFFFFF
  174.  
  175. /* Values for nfFmiWeight */
  176. #define nfWeightDontCare  0
  177. /* Meaningful values of weight: 100, 200, 300, 400, 500, 600, 700, 800, 900 */
  178.  
  179. /* Values for nfFmiPitch */
  180. #define nfSpacingDontCare      0
  181. #define nfSpacingProportional  1
  182. #define nfSpacingMonospaced    2
  183.  
  184. /* Values for nfFmiStyle */
  185. #define nfStyleDontCare   0
  186. #define nfStyleNormal     1
  187. #define nfStyleItalic     2
  188. #define nfStyleOblique    3
  189.  
  190. /* Values for nfFmiUnderline */
  191. #define nfUnderlineDontCare   0
  192. #define nfUnderlineYes        1
  193. #define nfUnderlineNo         2
  194.  
  195. /* Values for nfFmiStrikeOut */
  196. #define nfStrikeOutDontCare   0
  197. #define nfStrikeOutYes        1
  198. #define nfStrikeOutNo         2
  199.  
  200. /* Values for nfFmiResolutionX and nfFmiResolutionY */
  201. #define nfResolutionDontCare 0
  202.  
  203. /*
  204.  * List of predefined attributes for the FontMatchInfo
  205.  */
  206. #define nfFmiName                "nfFmiName"
  207. #define nfFmiCharset            "nfFmiCharset"
  208. #define nfFmiEncoding            "nfFmiEncoding"
  209. #define nfFmiWeight                "nfFmiWeight"
  210. #define nfFmiPitch                "nfFmiPitch"
  211. #define nfFmiStyle                "nfFmiStyle"
  212. #define nfFmiUnderline            "nfFmiUnderline"
  213. #define nfFmiStrikeOut            "nfFmiStrikeOut"
  214. /***
  215. #define nfFmiPanose                "nfFmiPanose"
  216. ***/
  217. #define nfFmiResolutionX        "nfFmiResolutionX"
  218. #define nfFmiResolutionY        "nfFmiResolutionY"
  219.  
  220. #endif /* _nf_H_ */
  221.