Back to index

lightning-sunbird  0.9+nobinonly
nsIFreeType2.idl
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is Golden Hills Computer Services code.
00016  *
00017  * The Initial Developer of the Original Code is Brian Stell.
00018  * Portions created by the Initial Developer are Copyright (C) 2002
00019  * the Initial Developer. All Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *      Brian Stell <bstell@ix.netcom.com>
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #include "nsISupports.idl"
00039 %{C++
00040 #include <ft2build.h>
00041 #include FT_FREETYPE_H
00042 #include FT_CACHE_H
00043 #include FT_CACHE_IMAGE_H
00044 #include FT_OUTLINE_H
00045 #include FT_TRUETYPE_TABLES_H
00046 #define NS_FREETYPE2_CONTRACTID "@mozilla.org/freetype2;1"
00047 #define NS_FREETYPE2_CID NS_IFREETYPE2_IID
00048 // macros to handle FreeType2 26.6 numbers (26 bit number with 6 bit fraction)
00049 #define FT_REG_TO_16_16(x) ((x)<<16)
00050 #ifndef FT_MulFix
00051 #define FT_MulFix(v, s) (((v)*(s))>>16)
00052 #endif
00053 #define FT_ROUND(x) (((x) + 32) & ~63) // 63 = 2^6 - 1
00054 #define FT_TRUNC(x) ((x) >> 6)
00055 #define FT_DESIGN_UNITS_TO_PIXELS(v, s) FT_TRUNC(FT_ROUND(FT_MulFix((v) , (s))))
00056 
00057 %}
00058 
00059 
00060 [ptr] native constCharPtr(const char);
00061 native FT_Int(FT_Int);
00062 native FT_Long(FT_Long);
00063 native FT_UInt(FT_UInt);
00064 native FT_ULong(FT_ULong);
00065 
00066 native FT_BBox(FT_BBox);
00067 native FT_CharMap(FT_CharMap);
00068 native FT_Error(FT_Error);
00069 native FT_Face(FT_Face);
00070 native FT_Glyph(FT_Glyph);
00071 native FT_GlyphSlot(FT_GlyphSlot);
00072 native FT_Library(FT_Library);
00073 [ptr] native FT_Outline_p(FT_Outline);
00074 [ptr] native const_FT_Outline_Funcs_p(const FT_Outline_Funcs);
00075 native FT_Pointer(FT_Pointer);
00076 native FT_Sfnt_Tag(FT_Sfnt_Tag);
00077 native FT_Size(FT_Size);
00078 
00079 [ptr] native FTC_Image_Desc_p(FTC_Image_Desc);
00080 native FTC_Face_Requester(FTC_Face_Requester);
00081 native FTC_Font(FTC_Font);
00082 native FTC_Image_Cache(FTC_Image_Cache);
00083 native FTC_Manager(FTC_Manager);
00084 
00085 // #ifdef MOZ_SVG
00086 [ptr] native FT_Matrix_p(FT_Matrix);
00087 native FT_Vector(FT_Vector);
00088 [ptr] native FT_Vector_p(FT_Vector);
00089 native FT_Render_Mode(FT_Render_Mode);
00090 native FT_Bool(FT_Bool);
00091 // #endif
00092 
00093 /*
00094  * A XPCOM interface to the run-time loaded functions
00095  */
00096 [uuid(c6e09354-1bb1-4ec2-aaa3-a26d0aafe36d)]
00097 interface nsIFreeType2 : nsISupports
00098 {
00099 
00100     readonly attribute FT_Library library;
00101     readonly attribute FTC_Manager FTCacheManager;
00102     readonly attribute FTC_Image_Cache ImageCache;
00103 
00104     void    doneFace(in FT_Face face);
00105     void    doneFreeType(in FT_Library lib);
00106     void    doneGlyph(in FT_Glyph glyph);
00107     FT_UInt getCharIndex(in FT_Face face, in FT_ULong charcode);
00108     void    getGlyph(in FT_GlyphSlot slot, out FT_Glyph glyph);
00109     voidPtr getSfntTable(in FT_Face face, in FT_Sfnt_Tag tag);
00110     void    glyphGetCBox(in FT_Glyph glyph, in FT_UInt mode, out FT_BBox box);
00111     void    initFreeType(out FT_Library lib);
00112     void    loadGlyph(in FT_Face face, in FT_UInt gindex, in FT_Int flags);
00113     void    newFace(in FT_Library lib, in constCharPtr filename,
00114                     in FT_Long face_num, out FT_Face face);
00115     void    outlineDecompose(in FT_Outline_p outline,
00116                              in const_FT_Outline_Funcs_p funcs, in voidPtr p);
00117     void    setCharmap(in FT_Face face, in FT_CharMap charmap);
00118     void    imageCacheLookup(in FTC_Image_Cache cache, in FTC_Image_Desc_p desc,
00119                              in FT_UInt gindex, out FT_Glyph glyph);
00120     void    managerLookupSize(in FTC_Manager manager, in FTC_Font font,
00121                               out FT_Face face, out FT_Size size);
00122     void    managerDone(in FTC_Manager manager);
00123     void    managerNew(in FT_Library lib, in FT_UInt max_faces,
00124                        in FT_UInt max_sizes, in FT_ULong max_bytes,
00125                        in FTC_Face_Requester requester, in FT_Pointer req_data,
00126                        out FTC_Manager manager);
00127     void    imageCacheNew(in FTC_Manager manager, out FTC_Image_Cache cache);
00128 /* #ifdef MOZ_SVG */
00129     void glyphTransform(in FT_Glyph glyph, in FT_Matrix_p matrix,
00130                         in FT_Vector_p delta);
00131     void getKerning(in FT_Face face, in FT_UInt left_glyph, in FT_UInt right_glyph,
00132                     in FT_UInt kern_mode, out FT_Vector akerning);
00133     void glyphCopy(in FT_Glyph source, out FT_Glyph target);
00134     void glyphToBitmap(inout FT_Glyph the_glyph, in FT_Render_Mode render_mode,
00135                        in FT_Vector_p origin, in FT_Bool destroy);
00136 /* #endif */
00137 
00138     FT_ULong getFirstChar(in FT_Face face, out FT_UInt gindex);
00139     FT_ULong getNextChar(in FT_Face face, in FT_ULong charcode, out FT_UInt gindex);
00140     void supportsExtFunc(out PRBool res);
00141 };