home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / modules / libfont / src / wfFCache.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.3 KB  |  79 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.  * wfFCache.h (wfFontCache.h)
  20.  *
  21.  * C++ implementation of a Font Cache. This does Font to Fmi
  22.  * mapping. Font <--> Fmi mapping is done by this.
  23.  *
  24.  * dp Suresh <dp@netscape.com>
  25.  */
  26.  
  27.  
  28. #ifndef _wfFCache_H_
  29. #define _wfFCache_H_
  30.  
  31. #include "libfont.h"
  32.  
  33. // Uses :    FontMatchInfo
  34. //            Font
  35. #include "Mnffmi.h"
  36. #include "Mnff.h"
  37.  
  38. #include "wfList.h"
  39.  
  40. struct font_store {
  41.   struct nffmi *fmi;
  42.   struct nff *f;
  43. };
  44.  
  45. // For now we are implementing the Cache using a List. Nspr has a
  46. // cache that we could use. We will wait for nspr to be Jmc'ized.
  47. //
  48. // Also, this will increment and decrement the reference count of each
  49. // object as it is being serviced.
  50. class wfFontObjectCache : private wfList {
  51. public:
  52.   wfFontObjectCache();
  53.   ~wfFontObjectCache();
  54.  
  55.   struct nff *RcFmi2Font(struct nfrc *rc, struct nffmi *fmi);
  56.  
  57.   struct nffmi *Font2Fmi(struct nff *f);
  58.  
  59.   struct nff *Rf2Font(struct nfrf *rf);
  60.  
  61.  
  62.   int add(struct nffmi *fmi, struct nff *f);
  63.   int remove(struct nffmi *fmi, struct nff *f);
  64.  
  65.   // releaseFont release all references to the Font in the fontObjectCache.
  66.   // It returns negative if there was any problem in releasing references
  67.   // to this Font. Else returns 0.
  68.   int releaseFont(struct nff *f);
  69.  
  70.   // Iterate through all the font objects and remove the reference
  71.   // to this rf in any of them. Once an rf is removed from any
  72.   // font, the font object cannot be shared any longer.
  73.   //
  74.   // returns the number of rfs that were released
  75.   //
  76.   int releaseRf(struct nfrf *rf);
  77. };
  78. #endif /* _wfFCache_H_ */
  79.