示例#1
0
func init() {
	tm := []glib.TypeMarshaler{
		// Enums
		// Objects/Interfaces
		{glib.Type(C.pango_font_description_get_type()), marshalFontDescription},
	}
	glib.RegisterGValueMarshalers(tm)
}
示例#2
0
文件: pango.go 项目: pauldub/go-gtk3
// PANGO init funcs {{{
func init() {

	// Initialize PangoWeight
	PangoWeight.THIN = 100
	PangoWeight.ULTRALIGHT = 200
	PangoWeight.LIGHT = 300
	PangoWeight.BOOK = 380
	PangoWeight.NORMAL = 400
	PangoWeight.MEDIUM = 500
	PangoWeight.SEMIBOLD = 600
	PangoWeight.BOLD = 700
	PangoWeight.ULTRABOLD = 800
	PangoWeight.HEAVY = 900
	PangoWeight.ULTRAHEAVY = 1000

	// Initialize PangoStyle
	PangoStyle.NORMAL = 0
	PangoStyle.OBLIQUE = 1
	PangoStyle.ITALIC = 2

	// Initialize PangoScale
	PangoScale.Scale = 1024
	PangoScale.XX_SMALL = float64(0.5787037037037)
	PangoScale.X_SMALL = float64(0.6444444444444)
	PangoScale.SMALL = float64(0.8333333333333)
	PangoScale.MEDIUM = float64(1.0)
	PangoScale.LARGE = float64(1.2)
	PangoScale.X_LARGE = float64(1.4399999999999)
	PangoScale.XX_LARGE = float64(1.728)

	// Initialize PangoUnderline
	PangoUnderline.NONE = 0
	PangoUnderline.SINGLE = 1
	PangoUnderline.DOUBLE = 2
	PangoUnderline.LOW = 3
	PangoUnderline.ERROR = 4

	// Initialize PangoVariant
	PangoVariant.NORMAL = 0
	PangoVariant.SMALL_CAPS = 1

	// Initialize PangoStretch
	PangoStretch.ULTRA_CONDENSED = 0
	PangoStretch.EXTRA_CONDENSED = 1
	PangoStretch.CONDENSED = 2
	PangoStretch.SEMI_CONDENSED = 3
	PangoStretch.NORMAL = 4
	PangoStretch.SEMI_EXPANDED = 5
	PangoStretch.EXPANDED = 6
	PangoStretch.EXTRA_EXPANDED = 7
	PangoStretch.ULTRA_EXPANDED = 8

	// Initialize PangoGravity
	PangoGravity.SOUTH = 0
	PangoGravity.EAST = 1
	PangoGravity.NORTH = 2
	PangoGravity.WEST = 3
	PangoGravity.AUTO = 4

	// Initialize PangoFontMask
	PangoFontMask.FAMILY = 1 << 0
	PangoFontMask.STYLE = 1 << 1
	PangoFontMask.VARIANT = 1 << 2
	PangoFontMask.WEIGHT = 1 << 3
	PangoFontMask.STRETCH = 1 << 4
	PangoFontMask.SIZE = 1 << 5
	PangoFontMask.GRAVITY = 1 << 6

	// Init PangoTypes
	PangoTypes.CONTEXT = gobject.GType(C.pango_context_get_type())
	PangoTypes.FONT = gobject.GType(C.pango_font_get_type())
	PangoTypes.FONT_FAMILY = gobject.GType(C.pango_font_family_get_type())
	PangoTypes.FONT_FACE = gobject.GType(C.pango_font_face_get_type())
	PangoTypes.FONT_MAP = gobject.GType(C.pango_font_map_get_type())
	PangoTypes.FONTSET = gobject.GType(C.pango_fontset_get_type())
	PangoTypes.FONT_DESCRIPTION = gobject.GType(C.pango_font_description_get_type())
	PangoTypes.LAYOUT = gobject.GType(C.pango_layout_get_type())

	// Register PangoContext type
	gobject.RegisterCType(PangoTypes.CONTEXT, newContextFromNative)
	gobject.RegisterGoType(PangoTypes.CONTEXT, nativeFromContext)

	// Register Font type
	gobject.RegisterCType(PangoTypes.FONT, newFontFromNative)
	gobject.RegisterGoType(PangoTypes.FONT, nativeFromFont)

	// Register FontFamily type
	gobject.RegisterCType(PangoTypes.FONT_FAMILY, newFontFamilyFromNative)
	gobject.RegisterGoType(PangoTypes.FONT_FAMILY, nativeFromFontFamily)

	// Register FontFace type
	gobject.RegisterCType(PangoTypes.FONT_FACE, newFontFaceFromNative)
	gobject.RegisterGoType(PangoTypes.FONT_FACE, nativeFromFontFace)

	// Register FontMap type
	gobject.RegisterCType(PangoTypes.FONT_MAP, newFontMapFromNative)
	gobject.RegisterGoType(PangoTypes.FONT_MAP, nativeFromFontMap)

	// Register Fontset type
	gobject.RegisterCType(PangoTypes.FONTSET, newFontsetFromNative)
	gobject.RegisterGoType(PangoTypes.FONTSET, nativeFromFontset)

	// Register FontDescription type
	gobject.RegisterCType(PangoTypes.FONT_DESCRIPTION, newFontDescriptionFromNative)
	gobject.RegisterGoType(PangoTypes.FONT_DESCRIPTION, nativeFromFontDescription)

	// Register Layout type
	gobject.RegisterCType(PangoTypes.LAYOUT, newLayoutFromNative)
	gobject.RegisterGoType(PangoTypes.LAYOUT, nativeFromLayout)

} // }}}