예제 #1
0
LayoutEngine::LayoutEngine(const LEFontInstance *fontInstance,
                           le_int32 scriptCode,
                           le_int32 languageCode,
                           le_int32 typoFlags,
                           LEErrorCode &success)
  : fHbFont(NULL), fHbBuffer(NULL), fTypoFlags(typoFlags)
{
    if (LE_FAILURE(success)) {
        return;
    }

    fHbBuffer = hb_buffer_create ();
    if (fHbBuffer == hb_buffer_get_empty ()) {
	success = LE_MEMORY_ALLOCATION_ERROR;
	return;
    }
    hb_buffer_set_unicode_funcs (fHbBuffer, hb_icu_get_unicode_funcs ());
    hb_buffer_set_script (fHbBuffer, hb_icu_script_to_script ((UScriptCode) scriptCode));
    /* TODO set language */

    hb_face_t *face = hb_face_create_for_tables (icu_le_hb_reference_table, (void *) fontInstance, NULL);
    fHbFont = hb_font_create (face);
    hb_face_destroy (face);
    if (fHbFont == hb_font_get_empty ()) {
        success = LE_MEMORY_ALLOCATION_ERROR;
	return;
    }
    hb_font_set_funcs (fHbFont, icu_le_hb_get_font_funcs (), (void *) fontInstance, NULL);
    hb_font_set_scale (fHbFont,
		       +from_float (fontInstance->getXPixelsPerEm () * fontInstance->getScaleFactorX ()),
		       -from_float (fontInstance->getYPixelsPerEm () * fontInstance->getScaleFactorY ()));
    hb_font_set_ppem (fHbFont,
		      fontInstance->getXPixelsPerEm (),
		      fontInstance->getYPixelsPerEm ());
}
예제 #2
0
파일: value.hpp 프로젝트: tanakamura/vstag
    TagIncludedValue operator +(TagIncludedValue rhs) const {
        switch (this->type()) {
        case TYPE_FIXNUM:
            switch (rhs.type()) {
            case TYPE_FIXNUM: {
                fixint_t l = fix2int(this->u.iv);
                fixint_t r = fix2int(rhs.u.iv);
                r = l + r;
                return from_int(r);
            }
                break;

            case TYPE_FLOAT: {
                double lv = fix2int(this->u.iv);
                Object *ro = rhs.u.obj;
                return from_float(lv + ro->u.fv);
            }
                break;

            default:
                abort();
            }
            break;

        case TYPE_FLOAT: {
            Object *lo = this->u.obj;
            switch (rhs.type()) {
            case TYPE_FIXNUM: {
                /* fl + fi */
                fixint_t r = fix2int(rhs.u.iv);
                double a = lo->u.fv + r;
                return from_float(a);
            }
                break;
                
            case TYPE_FLOAT: {
                Object *ro = rhs.u.obj;
                /* fl + fl */
                return from_float(lo->u.fv + ro->u.fv);
            }
                break;

            default:
                abort();    // ??
                break;
            }
        }
            break;

        default:
            abort();    // ??
        }
        abort();    // ??
    }
예제 #3
0
static hb_bool_t
icu_le_hb_font_get_glyph_contour_point (hb_font_t *font,
				        void *font_data,
				        hb_codepoint_t glyph,
				        unsigned int point_index,
				        hb_position_t *x,
				        hb_position_t *y,
				        void *user_data)
{
  const LEFontInstance *fontInstance = (const LEFontInstance *) font_data;
  LEPoint point;

  if (!fontInstance->getGlyphPoint (glyph, point_index, point))
    return false;

  *x = from_float (point.fX);
  *y = from_float (point.fY);

  return true;
}
예제 #4
0
static hb_position_t
icu_le_hb_font_get_glyph_h_advance (hb_font_t *font,
				    void *font_data,
				    hb_codepoint_t glyph,
				    void *user_data)
{
  const LEFontInstance *fontInstance = (const LEFontInstance *) font_data;
  LEPoint advance;

  fontInstance->getGlyphAdvance (glyph, advance);

  return from_float (advance.fX);
}
예제 #5
0
파일: object.c 프로젝트: tushargosavi/utils
/* 
 * Convert a object into another object
 */
Object *convert_object(Object *o, int type)
{
	switch(get_type(o)) {
		case T_INT :
			return from_int(o, type);
		case T_CHAR :
			return from_char(o, type);
		case T_STRING :
			return from_string(o, type);
		case T_FLOAT :
			return from_float(o, type);
		case T_BYTE_ARRAY :
			return from_barray(o, type);
	}
	/* Invalid tyep specified */
	return NULL;
}