home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / modules / libfont / src / wfSzList.h < prev   
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.6 KB  |  98 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.  * wfSzList.h
  20.  *
  21.  * Object local to libfont. This is used to track the association between
  22.  * rc, sizes[] and rf[] for a particular fh in a Font Object.
  23.  *
  24.  * dp Suresh <dp@netscape.com>
  25.  */
  26.  
  27.  
  28. #ifndef _wfSzList_H_
  29. #define _wfSzList_H_
  30.  
  31. #include "libfont.h"
  32.  
  33. // Uses :    RenderingContext
  34. //            RenderableFont
  35. //            FontDisplayer
  36. #include "Mnfrc.h"
  37. #include "Mnfrf.h"
  38.  
  39. #include "wffpPeer.h"
  40. #include "wfSzList.h"
  41.  
  42.  
  43. class wfSizesList {
  44. private:
  45.   int sizesLen;    // -1 indicates sizes was never intialized.
  46.   jdouble *sizes;
  47.   struct nfrf * *rfs;
  48.   int rfcount;
  49.   int maxrfcount;
  50.   const int rfAllocStep;
  51.  
  52. protected:
  53.   void freeSizes();
  54.  
  55. public:
  56.   // Constructor
  57.   wfSizesList();
  58.  
  59.   // Destructor
  60.   ~wfSizesList();
  61.  
  62.   // This can be used to see if the sizes list was ever initialized.
  63.   int initialized();
  64.  
  65.   // WARNING: sizes that is passed in is not copied.
  66.   int addSizes(jdouble *sizes);
  67.  
  68.   // Returns the array of sizes associated with the rc.
  69.   // WARNING: Caller DO NOT free the sizes that is returned.
  70.   jdouble *getSizes();
  71.  
  72.   // Remove a particular size from the size list for this rc
  73.   int removeSize(jdouble size);
  74.  
  75.   // Query if a particular size is available
  76.   int supportsSize(jdouble size);
  77.  
  78.   // Associate rf with size
  79.   int addRf(struct nfrf *rf);
  80.  
  81.   // Remove an rf. Returns number of rf's removed. 0 if none.
  82.   int removeRf(struct nfrf *rf);
  83.  
  84.   // Return zero if the rf does not exist. Else returns the number
  85.   // of times this rf exists.
  86.   int isRfExist(struct nfrf *rf);
  87.  
  88.   // number of rfs that are in this sizesList. This will be used to know
  89.   // when to release a fonthandle by the FontObject
  90.   int getRfCount();
  91.  
  92.   // Retrieve the rf that was associated with size
  93.   struct nfrf *getRf(jdouble pointsize);
  94. };
  95.  
  96. #endif /* _wfSzList_H_ */
  97.  
  98.