Author: jluke
Date: 2005-11-25 19:00:13 -0500 (Fri, 25 Nov 2005)
New Revision: 53490
Added:
trunk/mcs/class/Mono.Cairo/Mono.Cairo/FontOptions.cs
Modified:
trunk/mcs/class/Mono.Cairo/ChangeLog
trunk/mcs/class/Mono.Cairo/Mono.Cairo.dll.sources
trunk/mcs/class/Mono.Cairo/Mono.Cairo/Cairo.cs
trunk/mcs/class/Mono.Cairo/Mono.Cairo/Graphics.cs
Log:
2005-11-25 John Luke <[EMAIL PROTECTED]>
* Mono.Cairo/Cairo.cs: add font_options* api
add cairo_get_font_matrix
* Mono.Cairo/FontOptions.cs: add
* Mono.Cairo/Graphics.cs: add FontOptions property,
remove FontSize setter and FontSetSize(),
remove FontFace() method as SelectFontFace already exists
remove non-existant TransformFont() and Font property
Modified: trunk/mcs/class/Mono.Cairo/ChangeLog
===================================================================
--- trunk/mcs/class/Mono.Cairo/ChangeLog 2005-11-25 23:41:09 UTC (rev
53489)
+++ trunk/mcs/class/Mono.Cairo/ChangeLog 2005-11-26 00:00:13 UTC (rev
53490)
@@ -1,3 +1,13 @@
+2005-11-25 John Luke <[EMAIL PROTECTED]>
+
+ * Mono.Cairo/Cairo.cs: add font_options* api
+ add cairo_get_font_matrix
+ * Mono.Cairo/FontOptions.cs: add
+ * Mono.Cairo/Graphics.cs: add FontOptions property,
+ remove FontSize setter and FontSetSize(),
+ remove FontFace() method as SelectFontFace already exists
+ remove non-existant TransformFont() and Font property
+
2005-11-16 John Luke <[EMAIL PROTECTED]>
* snippets/*.cs: add snippets port
Modified: trunk/mcs/class/Mono.Cairo/Mono.Cairo/Cairo.cs
===================================================================
--- trunk/mcs/class/Mono.Cairo/Mono.Cairo/Cairo.cs 2005-11-25 23:41:09 UTC
(rev 53489)
+++ trunk/mcs/class/Mono.Cairo/Mono.Cairo/Cairo.cs 2005-11-26 00:00:13 UTC
(rev 53490)
@@ -222,6 +222,15 @@
double size);
[DllImport (CairoImp)]
+ public static extern IntPtr cairo_get_font_face (IntPtr cr);
+
+ [DllImport (CairoImp)]
+ public static extern void cairo_set_font_face (IntPtr cr,
IntPtr fontFace);
+
+ [DllImport (CairoImp)]
+ public static extern Matrix cairo_get_font_matrix (IntPtr cr);
+
+ [DllImport (CairoImp)]
public static extern void cairo_set_font_matrix (IntPtr cr,
Matrix matrix);
[DllImport (CairoImp)]
@@ -239,6 +248,58 @@
[DllImport (CairoImp)]
public static extern void cairo_text_extents (IntPtr cr,
string utf8, ref TextExtents extents);
+ // FontOptions
+ [DllImport (CairoImp)]
+ internal static extern IntPtr
cairo_font_options_create ();
+
+ [DllImport (CairoImp)]
+ internal static extern IntPtr
cairo_font_options_copy (IntPtr handle);
+
+ [DllImport (CairoImp)]
+ internal static extern void
cairo_font_options_destroy (IntPtr handle);
+
+ [DllImport (CairoImp)]
+ internal static extern bool
cairo_font_options_equal (IntPtr h1, IntPtr h2);
+
+ [DllImport (CairoImp)]
+ internal static extern long
cairo_font_options_hash (IntPtr handle);
+
+ [DllImport (CairoImp)]
+ internal static extern void
cairo_font_options_merge (IntPtr handle, IntPtr other);
+
+ [DllImport (CairoImp)]
+ internal static extern Antialias
cairo_font_options_get_antialias (IntPtr handle);
+
+ [DllImport (CairoImp)]
+ internal static extern void
cairo_font_options_set_antialias (IntPtr handle, Antialias aa);
+
+ [DllImport (CairoImp)]
+ internal static extern HintMetrics
cairo_font_options_get_hint_metrics (IntPtr handle);
+
+ [DllImport (CairoImp)]
+ internal static extern void
cairo_font_options_set_hint_metrics (IntPtr handle, HintMetrics metrics);
+
+ [DllImport (CairoImp)]
+ internal static extern HintStyle
cairo_font_options_get_hint_style (IntPtr handle);
+
+ [DllImport (CairoImp)]
+ internal static extern void
cairo_font_options_set_hint_style (IntPtr handle, HintStyle style);
+
+ [DllImport (CairoImp)]
+ internal static extern SubpixelOrder
cairo_font_options_get_subpixel_order (IntPtr handle);
+
+ [DllImport (CairoImp)]
+ internal static extern void
cairo_font_options_set_subpixel_order (IntPtr handle, SubpixelOrder order);
+
+ [DllImport (CairoImp)]
+ internal static extern Status
cairo_font_options_status (IntPtr handle);
+
+ [DllImport (CairoImp)]
+ internal static extern void
cairo_get_font_options (IntPtr cr, IntPtr options);
+
+ [DllImport (CairoImp)]
+ internal static extern void
cairo_set_font_options (IntPtr cr, IntPtr options);
+
[DllImport (CairoImp)]
public static extern void cairo_glyph_path (IntPtr ct, IntPtr
glyphs, int num_glyphs);
@@ -587,6 +648,28 @@
Reflect,
}
+ public enum HintMetrics {
+ Default,
+ Off,
+ On,
+ }
+
+ public enum HintStyle {
+ Default,
+ None,
+ Slight,
+ Medium,
+ Full,
+ }
+
+ public enum SubpixelOrder {
+ Default,
+ Rgb,
+ Bgr,
+ Vrgb,
+ Vbgr,
+ }
+
[StructLayout(LayoutKind.Sequential)]
public struct FontExtents
{
Added: trunk/mcs/class/Mono.Cairo/Mono.Cairo/FontOptions.cs
===================================================================
--- trunk/mcs/class/Mono.Cairo/Mono.Cairo/FontOptions.cs 2005-11-25
23:41:09 UTC (rev 53489)
+++ trunk/mcs/class/Mono.Cairo/Mono.Cairo/FontOptions.cs 2005-11-26
00:00:13 UTC (rev 53490)
@@ -0,0 +1,133 @@
+//
+// Mono.Cairo.FontOptions.cs
+//
+// Author:
+// John Luke ([EMAIL PROTECTED])
+//
+// (C) John Luke 2005.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+
+namespace Cairo
+{
+ public class FontOptions : IDisposable
+ {
+ IntPtr handle;
+ bool disposed = false;
+
+ public FontOptions ()
+ {
+ handle = CairoAPI.cairo_font_options_create ();
+ }
+
+ ~FontOptions ()
+ {
+ Dispose (false);
+ }
+
+ internal FontOptions (IntPtr handle)
+ {
+ this.handle = handle;
+ }
+
+ public FontOptions Copy ()
+ {
+ return new FontOptions
(CairoAPI.cairo_font_options_copy (handle));
+ }
+
+ public void Destroy ()
+ {
+ CairoAPI.cairo_font_options_destroy (handle);
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ private void Dispose (bool disposing)
+ {
+ if (!disposed) {
+ Destroy ();
+ handle = IntPtr.Zero;
+ }
+ disposed = true;
+ }
+
+ public static bool operator == (FontOptions options,
FontOptions other)
+ {
+ return CairoAPI.cairo_font_options_equal
(options.Handle, other.Handle);
+ }
+
+ public static bool operator != (FontOptions options,
FontOptions other)
+ {
+ return !(options == other);
+ }
+
+ public override bool Equals (object other)
+ {
+ if (other is FontOptions)
+ return this == (FontOptions) other;
+ return false;
+ }
+
+ public IntPtr Handle {
+ get { return handle; }
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int) CairoAPI.cairo_font_options_hash (handle);
+ }
+
+ public void Merge (FontOptions other)
+ {
+ CairoAPI.cairo_font_options_merge (handle,
other.Handle);
+ }
+
+ public Antialias Antialias {
+ get { return CairoAPI.cairo_font_options_get_antialias
(handle); }
+ set { CairoAPI.cairo_font_options_set_antialias
(handle, value); }
+ }
+
+ public HintMetrics HintMetrics {
+ get { return
CairoAPI.cairo_font_options_get_hint_metrics (handle);}
+ set { CairoAPI.cairo_font_options_set_hint_metrics
(handle, value); }
+ }
+
+ public HintStyle HintStyle {
+ get { return CairoAPI.cairo_font_options_get_hint_style
(handle);}
+ set { CairoAPI.cairo_font_options_set_hint_style
(handle, value); }
+ }
+
+ public Status Status {
+ get { return CairoAPI.cairo_font_options_status
(handle); }
+ }
+
+ public SubpixelOrder SubpixelOrder {
+ get { return
CairoAPI.cairo_font_options_get_subpixel_order (handle);}
+ set { CairoAPI.cairo_font_options_set_subpixel_order
(handle, value); }
+ }
+ }
+}
+
Modified: trunk/mcs/class/Mono.Cairo/Mono.Cairo/Graphics.cs
===================================================================
--- trunk/mcs/class/Mono.Cairo/Mono.Cairo/Graphics.cs 2005-11-25 23:41:09 UTC
(rev 53489)
+++ trunk/mcs/class/Mono.Cairo/Mono.Cairo/Graphics.cs 2005-11-26 00:00:13 UTC
(rev 53490)
@@ -527,43 +527,26 @@
return m;
}
}
- /*
- public Font Font {
- set {
- CairoAPI.cairo_set_font (state, value.Pointer);
- }
-
- get {
- IntPtr fnt = IntPtr.Zero;
-
- fnt = CairoAPI.cairo_current_font (state);
-
- return new Font (fnt);
- }
- }
- */
-
- // FIXME should be made into a property
- public void FontSetSize (double size)
- {
- CairoAPI.cairo_set_font_size (state, size);
- }
-
- // FIXME should be made into a property
- public void FontSetMatrix (Matrix m)
+ public void SetFontSize (double scale)
{
- CairoAPI.cairo_set_font_matrix (state, m);
+ CairoAPI.cairo_set_font_size (state, scale);
}
-
- /*
- public void TransformFont (Matrix matrix)
- {
- CairoAPI.cairo_transform_font (state, matrix.Pointer);
- }
- */
+
+ public Matrix FontMatrix {
+ get { return CairoAPI.cairo_get_font_matrix (state); }
+ set { CairoAPI.cairo_set_font_matrix (state, value); }
+ }
-
+ public FontOptions FontOptions {
+ get {
+ FontOptions options = new FontOptions ();
+ CairoAPI.cairo_get_font_options (state,
options.Handle);
+ return options;
+ }
+ set { CairoAPI.cairo_set_font_options (state,
value.Handle); }
+ }
+
static internal IntPtr FromGlyphToUnManagedMemory(Glyph []
glyphs)
{
int size = Marshal.SizeOf (glyphs[0]);
@@ -612,15 +595,6 @@
}
}
- public void FontFace (string family, FontSlant s, FontWeight w)
- {
- CairoAPI.cairo_select_font_face (state, family, s, w);
- }
-
- public double FontSize {
- set { CairoAPI.cairo_set_font_size (state, value); }
- }
-
public void CopyPage ()
{
CairoAPI.cairo_copy_page (state);
@@ -631,11 +605,6 @@
CairoAPI.cairo_select_font_face (state, family, slant,
weight);
}
- public void SetFontSize (double scale)
- {
- CairoAPI.cairo_set_font_size (state, scale);
- }
-
public void ShowPage ()
{
CairoAPI.cairo_show_page (state);
Modified: trunk/mcs/class/Mono.Cairo/Mono.Cairo.dll.sources
===================================================================
--- trunk/mcs/class/Mono.Cairo/Mono.Cairo.dll.sources 2005-11-25 23:41:09 UTC
(rev 53489)
+++ trunk/mcs/class/Mono.Cairo/Mono.Cairo.dll.sources 2005-11-26 00:00:13 UTC
(rev 53490)
@@ -2,6 +2,7 @@
../../build/common/Consts.cs
../../build/common/Locale.cs
./Mono.Cairo/Cairo.cs
+./Mono.Cairo/FontOptions.cs
./Mono.Cairo/Matrix.cs
./Mono.Cairo/Graphics.cs
./Mono.Cairo/Surface.cs
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches