diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-12-01 17:33:57 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-12-01 17:33:57 +0100 |
| commit | 6d1e30cd3c0060a914b2bde43e7c8d832207e202 (patch) | |
| tree | 8b4695b7c8acdf2da0dca1a6e255ae685ad42a35 /src | |
| parent | ab73969ea4c317bff252176ed3d57f45ccde6924 (diff) | |
| download | box64-6d1e30cd3c0060a914b2bde43e7c8d832207e202.tar.gz box64-6d1e30cd3c0060a914b2bde43e7c8d832207e202.zip | |
[BOX32][WRAPPER] Improved 32bits freetype wrapping (wine explorer have correct fonts now)
Diffstat (limited to 'src')
| -rw-r--r-- | src/wrapped32/generated/functions_list.txt | 13 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrappedfreetypetypes32.h | 8 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.c | 10 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.h | 5 | ||||
| -rw-r--r-- | src/wrapped32/wrappedfreetype.c | 918 | ||||
| -rw-r--r-- | src/wrapped32/wrappedfreetype_private.h | 8 |
6 files changed, 738 insertions, 224 deletions
diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt index f5443203..0195599b 100644 --- a/src/wrapped32/generated/functions_list.txt +++ b/src/wrapped32/generated/functions_list.txt @@ -643,6 +643,7 @@ #() vFbp_pp -> vFBpp #() vFXLbL_ -> vFXLB #() vFXbL_i -> vFXBi +#() iFEpBp_ -> iFEpB #() iFpibl_ -> iFpiB #() iFplbl_ -> iFplB #() iEppBp_ -> iEppB @@ -687,14 +688,12 @@ #() iFbp_bp_p -> iFBBp #() iFXbiip_i -> iFXBi #() iFXbLip_L -> iFXBL -#() vFpuBLLLL_ -> vFpuB #() vFXLbpLiL_ -> vFXLB #() vFXLrpLiL_ -> vFXLB #() iFXLbpLiL_ -> iFXLB #() iFXLbLLii_ -> iFXLB #() pFXrLiiuL_p -> pFXBp #() iFXLbLWWWcc_ -> iFXLB -#() iFprllll_rll_ -> iFpBB #() iEirLLLL_BLLLL_ -> iEiBB #() pEppriiiiiiiiilt_ -> pEppB #() vEEipp -> vEEipp @@ -979,6 +978,7 @@ #() iEbp_bL_iS -> iEBBiS #() iFbp_bp_pi -> iFBBpi #() iFXbL_ibp_ -> iFXBiB +#() vFEpuBLLLL_ -> vFEpuB #() vFbp_ppbup_ -> vFBppB #() vFXLbpLiL_L -> vFXLBL #() iFXLbpLiL_L -> iFXLBL @@ -987,6 +987,7 @@ #() iFXLpbLWWWcc_ -> iFXLpB #() iFXLbLWWWcc_i -> iFXLBi #() pESBppppii_pi -> pESBpi +#() iFEprllll_rll_ -> iFEpBB #() iFXLuriiiiiLi_ -> iFXLuB #() vFXLbLLLLLLLLLL_L -> vFXLBL #() iFXLbLLLLLLLLLL_L -> iFXLBL @@ -1650,6 +1651,8 @@ wrappedfontconfig: - iFppiUi: - FcPatternAdd wrappedfreetype: +- vFp: + - FT_Done_Glyph - iFp: - FT_Activate_Size - FT_Done_Face @@ -1686,6 +1689,8 @@ wrappedfreetype: - FT_Get_First_Char - pFpi: - FT_Get_Sfnt_Table +- iFpBp_: + - FT_Glyph_Copy - vFpll: - FT_Outline_Translate - vFppp: @@ -1706,6 +1711,10 @@ wrappedfreetype: - FT_Outline_Get_Bitmap - LFpLp: - FT_Get_Next_Char +- vFpuBLLLL_: + - FT_Glyph_Get_CBox +- iFprllll_rll_: + - FT_Glyph_Transform - iFpuip: - FT_Outline_New - iFpupu: diff --git a/src/wrapped32/generated/wrappedfreetypetypes32.h b/src/wrapped32/generated/wrappedfreetypetypes32.h index 3305bef6..bfa0a566 100644 --- a/src/wrapped32/generated/wrappedfreetypetypes32.h +++ b/src/wrapped32/generated/wrappedfreetypetypes32.h @@ -11,6 +11,7 @@ #define ADDED_FUNCTIONS() #endif +typedef void (*vFp_t)(void*); typedef int32_t (*iFp_t)(void*); typedef uint32_t (*uFp_t)(void*); typedef void* (*pFp_t)(void*); @@ -22,6 +23,7 @@ typedef int32_t (*iFpp_t)(void*, void*); typedef uint32_t (*uFpL_t)(void*, uintptr_t); typedef uintptr_t (*LFpp_t)(void*, void*); typedef void* (*pFpi_t)(void*, int32_t); +typedef int32_t (*iFpBp__t)(void*, struct_p_t*); typedef void (*vFpll_t)(void*, intptr_t, intptr_t); typedef void (*vFppp_t)(void*, void*, void*); typedef int32_t (*iFpip_t)(void*, int32_t, void*); @@ -31,6 +33,8 @@ typedef int32_t (*iFpll_t)(void*, intptr_t, intptr_t); typedef int32_t (*iFpLi_t)(void*, uintptr_t, int32_t); typedef int32_t (*iFppp_t)(void*, void*, void*); typedef uintptr_t (*LFpLp_t)(void*, uintptr_t, void*); +typedef void (*vFpuBLLLL__t)(void*, uint32_t, struct_LLLL_t*); +typedef int32_t (*iFprllll_rll__t)(void*, struct_llll_t*, struct_ll_t*); typedef int32_t (*iFpuip_t)(void*, uint32_t, int32_t, void*); typedef int32_t (*iFpupu_t)(void*, uint32_t, void*, uint32_t); typedef int32_t (*iFpplp_t)(void*, void*, intptr_t, void*); @@ -40,6 +44,7 @@ typedef int32_t (*iFpLlpp_t)(void*, uintptr_t, intptr_t, void*, void*); typedef int32_t (*iFppllp_t)(void*, void*, intptr_t, intptr_t, void*); #define SUPER() ADDED_FUNCTIONS() \ + GO(FT_Done_Glyph, vFp_t) \ GO(FT_Activate_Size, iFp_t) \ GO(FT_Done_Face, iFp_t) \ GO(FT_Done_Size, iFp_t) \ @@ -65,6 +70,7 @@ typedef int32_t (*iFppllp_t)(void*, void*, intptr_t, intptr_t, void*); GO(FT_Get_Char_Index, uFpL_t) \ GO(FT_Get_First_Char, LFpp_t) \ GO(FT_Get_Sfnt_Table, pFpi_t) \ + GO(FT_Glyph_Copy, iFpBp__t) \ GO(FT_Outline_Translate, vFpll_t) \ GO(FT_Set_Transform, vFppp_t) \ GO(FT_Get_Sfnt_Name, iFpip_t) \ @@ -76,6 +82,8 @@ typedef int32_t (*iFppllp_t)(void*, void*, intptr_t, intptr_t, void*); GO(FT_Outline_Decompose, iFppp_t) \ GO(FT_Outline_Get_Bitmap, iFppp_t) \ GO(FT_Get_Next_Char, LFpLp_t) \ + GO(FT_Glyph_Get_CBox, vFpuBLLLL__t) \ + GO(FT_Glyph_Transform, iFprllll_rll__t) \ GO(FT_Outline_New, iFpuip_t) \ GO(FT_Get_Glyph_Name, iFpupu_t) \ GO(FT_New_Face, iFpplp_t) \ diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c index e8a936a8..263236b1 100644 --- a/src/wrapped32/generated/wrapper32.c +++ b/src/wrapped32/generated/wrapper32.c @@ -734,6 +734,7 @@ typedef void (*vFpbp_i_t)(void*, struct_p_t*, int32_t); typedef void (*vFbp_pp_t)(struct_p_t*, void*, void*); typedef void (*vFXLbL__t)(void*, uintptr_t, struct_L_t*); typedef void (*vFXbL_i_t)(void*, struct_L_t*, int32_t); +typedef int32_t (*iFEpBp__t)(x64emu_t*, void*, struct_p_t*); typedef int32_t (*iFpibl__t)(void*, int32_t, struct_l_t*); typedef int32_t (*iFplbl__t)(void*, intptr_t, struct_l_t*); typedef int32_t (*iEppBp__t)(void*, void*, struct_p_t*); @@ -778,14 +779,12 @@ typedef int32_t (*iFpbL_bL__t)(void*, struct_L_t*, struct_L_t*); typedef int32_t (*iFbp_bp_p_t)(struct_p_t*, struct_p_t*, void*); typedef int32_t (*iFXbiip_i_t)(void*, struct_iip_t*, int32_t); typedef int32_t (*iFXbLip_L_t)(void*, struct_Lip_t*, uintptr_t); -typedef void (*vFpuBLLLL__t)(void*, uint32_t, struct_LLLL_t*); typedef void (*vFXLbpLiL__t)(void*, uintptr_t, struct_pLiL_t*); typedef void (*vFXLrpLiL__t)(void*, uintptr_t, struct_pLiL_t*); typedef int32_t (*iFXLbpLiL__t)(void*, uintptr_t, struct_pLiL_t*); typedef int32_t (*iFXLbLLii__t)(void*, uintptr_t, struct_LLii_t*); typedef void* (*pFXrLiiuL_p_t)(void*, struct_LiiuL_t*, void*); typedef int32_t (*iFXLbLWWWcc__t)(void*, uintptr_t, struct_LWWWcc_t*); -typedef int32_t (*iFprllll_rll__t)(void*, struct_llll_t*, struct_ll_t*); typedef int32_t (*iEirLLLL_BLLLL__t)(int32_t, struct_LLLL_t*, struct_LLLL_t*); typedef void* (*pEppriiiiiiiiilt__t)(void*, void*, struct_iiiiiiiiilt_t*); typedef void (*vEEipp_t)(x64emu_t*, int32_t, void*, void*); @@ -1070,6 +1069,7 @@ typedef int32_t (*iFrpuu_Lui_t)(struct_puu_t*, uintptr_t, uint32_t, int32_t); typedef int32_t (*iEbp_bL_iS_t)(struct_p_t*, struct_L_t*, int32_t, void*); typedef int32_t (*iFbp_bp_pi_t)(struct_p_t*, struct_p_t*, void*, int32_t); typedef int32_t (*iFXbL_ibp__t)(void*, struct_L_t*, int32_t, struct_p_t*); +typedef void (*vFEpuBLLLL__t)(x64emu_t*, void*, uint32_t, struct_LLLL_t*); typedef void (*vFbp_ppbup__t)(struct_p_t*, void*, void*, struct_up_t*); typedef void (*vFXLbpLiL_L_t)(void*, uintptr_t, struct_pLiL_t*, uintptr_t); typedef int32_t (*iFXLbpLiL_L_t)(void*, uintptr_t, struct_pLiL_t*, uintptr_t); @@ -1078,6 +1078,7 @@ typedef int32_t (*iEuirLL_BLL__t)(uint32_t, int32_t, struct_LL_t*, struct_LL_t*) typedef int32_t (*iFXLpbLWWWcc__t)(void*, uintptr_t, void*, struct_LWWWcc_t*); typedef int32_t (*iFXLbLWWWcc_i_t)(void*, uintptr_t, struct_LWWWcc_t*, int32_t); typedef void* (*pESBppppii_pi_t)(void*, struct_ppppii_t*, void*, int32_t); +typedef int32_t (*iFEprllll_rll__t)(x64emu_t*, void*, struct_llll_t*, struct_ll_t*); typedef int32_t (*iFXLuriiiiiLi__t)(void*, uintptr_t, uint32_t, struct_iiiiiLi_t*); typedef void (*vFXLbLLLLLLLLLL_L_t)(void*, uintptr_t, struct_LLLLLLLLLL_t*, uintptr_t); typedef int32_t (*iFXLbLLLLLLLLLL_L_t)(void*, uintptr_t, struct_LLLLLLLLLL_t*, uintptr_t); @@ -2377,6 +2378,7 @@ void vFpbp_i_32(x64emu_t *emu, uintptr_t fcn) { vFpbp_i_t fn = (vFpbp_i_t)fcn; s void vFbp_pp_32(x64emu_t *emu, uintptr_t fcn) { vFbp_pp_t fn = (vFbp_pp_t)fcn; struct_p_t arg_4={0}; if (*(ptr_t*)(from_ptr((R_ESP + 4)))) from_struct_p(&arg_4, *(ptr_t*)(from_ptr((R_ESP + 4)))); fn(*(ptr_t*)(from_ptr((R_ESP + 4))) ? &arg_4 : NULL, from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12)); if (*(ptr_t*)(from_ptr((R_ESP + 4)))) to_struct_p(*(ptr_t*)(from_ptr((R_ESP + 4))), &arg_4); } void vFXLbL__32(x64emu_t *emu, uintptr_t fcn) { vFXLbL__t fn = (vFXLbL__t)fcn; struct_L_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_L(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_L(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); } void vFXbL_i_32(x64emu_t *emu, uintptr_t fcn) { vFXbL_i_t fn = (vFXbL_i_t)fcn; struct_L_t arg_8={0}; if (*(ptr_t*)(from_ptr((R_ESP + 8)))) from_struct_L(&arg_8, *(ptr_t*)(from_ptr((R_ESP + 8)))); fn(getDisplay(from_ptriv(R_ESP + 4)), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, from_ptri(int32_t, R_ESP + 12)); if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_L(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); } +void iFEpBp__32(x64emu_t *emu, uintptr_t fcn) { iFEpBp__t fn = (iFEpBp__t)fcn; struct_p_t arg_8={0}; R_EAX = fn(emu, from_ptriv(R_ESP + 4), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_p(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); } void iFpibl__32(x64emu_t *emu, uintptr_t fcn) { iFpibl__t fn = (iFpibl__t)fcn; struct_l_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_l(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); R_EAX = fn(from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_l(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); } void iFplbl__32(x64emu_t *emu, uintptr_t fcn) { iFplbl__t fn = (iFplbl__t)fcn; struct_l_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_l(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); R_EAX = fn(from_ptriv(R_ESP + 4), from_long(from_ptri(long_t, R_ESP + 8)), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_l(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); } void iEppBp__32(x64emu_t *emu, uintptr_t fcn) { iEppBp__t fn = (iEppBp__t)fcn; errno = emu->libc_err; struct_p_t arg_12={0}; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_p(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); emu->libc_err = errno; } @@ -2421,14 +2423,12 @@ void iFpbL_bL__32(x64emu_t *emu, uintptr_t fcn) { iFpbL_bL__t fn = (iFpbL_bL__t) void iFbp_bp_p_32(x64emu_t *emu, uintptr_t fcn) { iFbp_bp_p_t fn = (iFbp_bp_p_t)fcn; struct_p_t arg_4={0}; if (*(ptr_t*)(from_ptr((R_ESP + 4)))) from_struct_p(&arg_4, *(ptr_t*)(from_ptr((R_ESP + 4)))); struct_p_t arg_8={0}; if (*(ptr_t*)(from_ptr((R_ESP + 8)))) from_struct_p(&arg_8, *(ptr_t*)(from_ptr((R_ESP + 8)))); R_EAX = fn(*(ptr_t*)(from_ptr((R_ESP + 4))) ? &arg_4 : NULL, *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, from_ptriv(R_ESP + 12)); if (*(ptr_t*)(from_ptr((R_ESP + 4)))) to_struct_p(*(ptr_t*)(from_ptr((R_ESP + 4))), &arg_4); if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_p(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); } void iFXbiip_i_32(x64emu_t *emu, uintptr_t fcn) { iFXbiip_i_t fn = (iFXbiip_i_t)fcn; struct_iip_t arg_8={0}; if (*(ptr_t*)(from_ptr((R_ESP + 8)))) from_struct_iip(&arg_8, *(ptr_t*)(from_ptr((R_ESP + 8)))); R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, from_ptri(int32_t, R_ESP + 12)); if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_iip(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); } void iFXbLip_L_32(x64emu_t *emu, uintptr_t fcn) { iFXbLip_L_t fn = (iFXbLip_L_t)fcn; struct_Lip_t arg_8={0}; if (*(ptr_t*)(from_ptr((R_ESP + 8)))) from_struct_Lip(&arg_8, *(ptr_t*)(from_ptr((R_ESP + 8)))); R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, from_ulong(from_ptri(ulong_t, R_ESP + 12))); if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_Lip(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); } -void vFpuBLLLL__32(x64emu_t *emu, uintptr_t fcn) { vFpuBLLLL__t fn = (vFpuBLLLL__t)fcn; struct_LLLL_t arg_12={0}; fn(from_ptriv(R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_LLLL(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); } void vFXLbpLiL__32(x64emu_t *emu, uintptr_t fcn) { vFXLbpLiL__t fn = (vFXLbpLiL__t)fcn; struct_pLiL_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_pLiL(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_pLiL(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); } void vFXLrpLiL__32(x64emu_t *emu, uintptr_t fcn) { vFXLrpLiL__t fn = (vFXLrpLiL__t)fcn; struct_pLiL_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_pLiL(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL); } void iFXLbpLiL__32(x64emu_t *emu, uintptr_t fcn) { iFXLbpLiL__t fn = (iFXLbpLiL__t)fcn; struct_pLiL_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_pLiL(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_pLiL(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); } void iFXLbLLii__32(x64emu_t *emu, uintptr_t fcn) { iFXLbLLii__t fn = (iFXLbLLii__t)fcn; struct_LLii_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_LLii(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_LLii(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); } void pFXrLiiuL_p_32(x64emu_t *emu, uintptr_t fcn) { pFXrLiiuL_p_t fn = (pFXrLiiuL_p_t)fcn; struct_LiiuL_t arg_8={0}; if (*(ptr_t*)(from_ptr((R_ESP + 8)))) from_struct_LiiuL(&arg_8, *(ptr_t*)(from_ptr((R_ESP + 8)))); R_EAX = to_ptrv(fn(getDisplay(from_ptriv(R_ESP + 4)), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, from_ptriv(R_ESP + 12))); } void iFXLbLWWWcc__32(x64emu_t *emu, uintptr_t fcn) { iFXLbLWWWcc__t fn = (iFXLbLWWWcc__t)fcn; struct_LWWWcc_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_LWWWcc(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_LWWWcc(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); } -void iFprllll_rll__32(x64emu_t *emu, uintptr_t fcn) { iFprllll_rll__t fn = (iFprllll_rll__t)fcn; struct_llll_t arg_8={0}; if (*(ptr_t*)(from_ptr((R_ESP + 8)))) from_struct_llll(&arg_8, *(ptr_t*)(from_ptr((R_ESP + 8)))); struct_ll_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_ll(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); R_EAX = fn(from_ptriv(R_ESP + 4), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL); } void iEirLLLL_BLLLL__32(x64emu_t *emu, uintptr_t fcn) { iEirLLLL_BLLLL__t fn = (iEirLLLL_BLLLL__t)fcn; errno = emu->libc_err; struct_LLLL_t arg_8={0}; if (*(ptr_t*)(from_ptr((R_ESP + 8)))) from_struct_LLLL(&arg_8, *(ptr_t*)(from_ptr((R_ESP + 8)))); struct_LLLL_t arg_12={0}; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_LLLL(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); emu->libc_err = errno; } void pEppriiiiiiiiilt__32(x64emu_t *emu, uintptr_t fcn) { pEppriiiiiiiiilt__t fn = (pEppriiiiiiiiilt__t)fcn; errno = emu->libc_err; struct_iiiiiiiiilt_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_iiiiiiiiilt(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); R_EAX = to_ptrv(fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL)); emu->libc_err = errno; } void vEEipp_32(x64emu_t *emu, uintptr_t fcn) { vEEipp_t fn = (vEEipp_t)fcn; errno = emu->libc_err; fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12)); emu->libc_err = errno; } @@ -2713,6 +2713,7 @@ void iFrpuu_Lui_32(x64emu_t *emu, uintptr_t fcn) { iFrpuu_Lui_t fn = (iFrpuu_Lui void iEbp_bL_iS_32(x64emu_t *emu, uintptr_t fcn) { iEbp_bL_iS_t fn = (iEbp_bL_iS_t)fcn; errno = emu->libc_err; struct_p_t arg_4={0}; if (*(ptr_t*)(from_ptr((R_ESP + 4)))) from_struct_p(&arg_4, *(ptr_t*)(from_ptr((R_ESP + 4)))); struct_L_t arg_8={0}; if (*(ptr_t*)(from_ptr((R_ESP + 8)))) from_struct_L(&arg_8, *(ptr_t*)(from_ptr((R_ESP + 8)))); R_EAX = fn(*(ptr_t*)(from_ptr((R_ESP + 4))) ? &arg_4 : NULL, *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, from_ptri(int32_t, R_ESP + 12), io_convert32(from_ptriv(R_ESP + 16))); if (*(ptr_t*)(from_ptr((R_ESP + 4)))) to_struct_p(*(ptr_t*)(from_ptr((R_ESP + 4))), &arg_4); if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_L(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); emu->libc_err = errno; } void iFbp_bp_pi_32(x64emu_t *emu, uintptr_t fcn) { iFbp_bp_pi_t fn = (iFbp_bp_pi_t)fcn; struct_p_t arg_4={0}; if (*(ptr_t*)(from_ptr((R_ESP + 4)))) from_struct_p(&arg_4, *(ptr_t*)(from_ptr((R_ESP + 4)))); struct_p_t arg_8={0}; if (*(ptr_t*)(from_ptr((R_ESP + 8)))) from_struct_p(&arg_8, *(ptr_t*)(from_ptr((R_ESP + 8)))); R_EAX = fn(*(ptr_t*)(from_ptr((R_ESP + 4))) ? &arg_4 : NULL, *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, from_ptriv(R_ESP + 12), from_ptri(int32_t, R_ESP + 16)); if (*(ptr_t*)(from_ptr((R_ESP + 4)))) to_struct_p(*(ptr_t*)(from_ptr((R_ESP + 4))), &arg_4); if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_p(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); } void iFXbL_ibp__32(x64emu_t *emu, uintptr_t fcn) { iFXbL_ibp__t fn = (iFXbL_ibp__t)fcn; struct_L_t arg_8={0}; if (*(ptr_t*)(from_ptr((R_ESP + 8)))) from_struct_L(&arg_8, *(ptr_t*)(from_ptr((R_ESP + 8)))); struct_p_t arg_16={0}; if (*(ptr_t*)(from_ptr((R_ESP + 16)))) from_struct_p(&arg_16, *(ptr_t*)(from_ptr((R_ESP + 16)))); R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, from_ptri(int32_t, R_ESP + 12), *(ptr_t*)(from_ptr((R_ESP + 16))) ? &arg_16 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_L(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); if (*(ptr_t*)(from_ptr((R_ESP + 16)))) to_struct_p(*(ptr_t*)(from_ptr((R_ESP + 16))), &arg_16); } +void vFEpuBLLLL__32(x64emu_t *emu, uintptr_t fcn) { vFEpuBLLLL__t fn = (vFEpuBLLLL__t)fcn; struct_LLLL_t arg_12={0}; fn(emu, from_ptriv(R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_LLLL(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); } void vFbp_ppbup__32(x64emu_t *emu, uintptr_t fcn) { vFbp_ppbup__t fn = (vFbp_ppbup__t)fcn; struct_p_t arg_4={0}; if (*(ptr_t*)(from_ptr((R_ESP + 4)))) from_struct_p(&arg_4, *(ptr_t*)(from_ptr((R_ESP + 4)))); struct_up_t arg_16={0}; if (*(ptr_t*)(from_ptr((R_ESP + 16)))) from_struct_up(&arg_16, *(ptr_t*)(from_ptr((R_ESP + 16)))); fn(*(ptr_t*)(from_ptr((R_ESP + 4))) ? &arg_4 : NULL, from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), *(ptr_t*)(from_ptr((R_ESP + 16))) ? &arg_16 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 4)))) to_struct_p(*(ptr_t*)(from_ptr((R_ESP + 4))), &arg_4); if (*(ptr_t*)(from_ptr((R_ESP + 16)))) to_struct_up(*(ptr_t*)(from_ptr((R_ESP + 16))), &arg_16); } void vFXLbpLiL_L_32(x64emu_t *emu, uintptr_t fcn) { vFXLbpLiL_L_t fn = (vFXLbpLiL_L_t)fcn; struct_pLiL_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_pLiL(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL, from_ulong(from_ptri(ulong_t, R_ESP + 16))); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_pLiL(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); } void iFXLbpLiL_L_32(x64emu_t *emu, uintptr_t fcn) { iFXLbpLiL_L_t fn = (iFXLbpLiL_L_t)fcn; struct_pLiL_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_pLiL(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL, from_ulong(from_ptri(ulong_t, R_ESP + 16))); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_pLiL(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); } @@ -2721,6 +2722,7 @@ void iEuirLL_BLL__32(x64emu_t *emu, uintptr_t fcn) { iEuirLL_BLL__t fn = (iEuirL void iFXLpbLWWWcc__32(x64emu_t *emu, uintptr_t fcn) { iFXLpbLWWWcc__t fn = (iFXLpbLWWWcc__t)fcn; struct_LWWWcc_t arg_16={0}; if (*(ptr_t*)(from_ptr((R_ESP + 16)))) from_struct_LWWWcc(&arg_16, *(ptr_t*)(from_ptr((R_ESP + 16)))); R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptriv(R_ESP + 12), *(ptr_t*)(from_ptr((R_ESP + 16))) ? &arg_16 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 16)))) to_struct_LWWWcc(*(ptr_t*)(from_ptr((R_ESP + 16))), &arg_16); } void iFXLbLWWWcc_i_32(x64emu_t *emu, uintptr_t fcn) { iFXLbLWWWcc_i_t fn = (iFXLbLWWWcc_i_t)fcn; struct_LWWWcc_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_LWWWcc(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL, from_ptri(int32_t, R_ESP + 16)); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_LWWWcc(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); } void pESBppppii_pi_32(x64emu_t *emu, uintptr_t fcn) { pESBppppii_pi_t fn = (pESBppppii_pi_t)fcn; errno = emu->libc_err; struct_ppppii_t arg_8={0}; R_EAX = to_ptrv(fn(io_convert32(from_ptriv(R_ESP + 4)), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, from_ptriv(R_ESP + 12), from_ptri(int32_t, R_ESP + 16))); if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_ppppii(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); emu->libc_err = errno; } +void iFEprllll_rll__32(x64emu_t *emu, uintptr_t fcn) { iFEprllll_rll__t fn = (iFEprllll_rll__t)fcn; struct_llll_t arg_8={0}; if (*(ptr_t*)(from_ptr((R_ESP + 8)))) from_struct_llll(&arg_8, *(ptr_t*)(from_ptr((R_ESP + 8)))); struct_ll_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_ll(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); R_EAX = fn(emu, from_ptriv(R_ESP + 4), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL); } void iFXLuriiiiiLi__32(x64emu_t *emu, uintptr_t fcn) { iFXLuriiiiiLi__t fn = (iFXLuriiiiiLi__t)fcn; struct_iiiiiLi_t arg_16={0}; if (*(ptr_t*)(from_ptr((R_ESP + 16)))) from_struct_iiiiiLi(&arg_16, *(ptr_t*)(from_ptr((R_ESP + 16)))); R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(uint32_t, R_ESP + 12), *(ptr_t*)(from_ptr((R_ESP + 16))) ? &arg_16 : NULL); } void vFXLbLLLLLLLLLL_L_32(x64emu_t *emu, uintptr_t fcn) { vFXLbLLLLLLLLLL_L_t fn = (vFXLbLLLLLLLLLL_L_t)fcn; struct_LLLLLLLLLL_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_LLLLLLLLLL(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL, from_ulong(from_ptri(ulong_t, R_ESP + 16))); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_LLLLLLLLLL(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); } void iFXLbLLLLLLLLLL_L_32(x64emu_t *emu, uintptr_t fcn) { iFXLbLLLLLLLLLL_L_t fn = (iFXLbLLLLLLLLLL_L_t)fcn; struct_LLLLLLLLLL_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_LLLLLLLLLL(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL, from_ulong(from_ptri(ulong_t, R_ESP + 16))); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_LLLLLLLLLL(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); } diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h index 46dce8f2..94568724 100644 --- a/src/wrapped32/generated/wrapper32.h +++ b/src/wrapped32/generated/wrapper32.h @@ -684,6 +684,7 @@ void vFpbp_i_32(x64emu_t *emu, uintptr_t fnc); void vFbp_pp_32(x64emu_t *emu, uintptr_t fnc); void vFXLbL__32(x64emu_t *emu, uintptr_t fnc); void vFXbL_i_32(x64emu_t *emu, uintptr_t fnc); +void iFEpBp__32(x64emu_t *emu, uintptr_t fnc); void iFpibl__32(x64emu_t *emu, uintptr_t fnc); void iFplbl__32(x64emu_t *emu, uintptr_t fnc); void iEppBp__32(x64emu_t *emu, uintptr_t fnc); @@ -728,14 +729,12 @@ void iFpbL_bL__32(x64emu_t *emu, uintptr_t fnc); void iFbp_bp_p_32(x64emu_t *emu, uintptr_t fnc); void iFXbiip_i_32(x64emu_t *emu, uintptr_t fnc); void iFXbLip_L_32(x64emu_t *emu, uintptr_t fnc); -void vFpuBLLLL__32(x64emu_t *emu, uintptr_t fnc); void vFXLbpLiL__32(x64emu_t *emu, uintptr_t fnc); void vFXLrpLiL__32(x64emu_t *emu, uintptr_t fnc); void iFXLbpLiL__32(x64emu_t *emu, uintptr_t fnc); void iFXLbLLii__32(x64emu_t *emu, uintptr_t fnc); void pFXrLiiuL_p_32(x64emu_t *emu, uintptr_t fnc); void iFXLbLWWWcc__32(x64emu_t *emu, uintptr_t fnc); -void iFprllll_rll__32(x64emu_t *emu, uintptr_t fnc); void iEirLLLL_BLLLL__32(x64emu_t *emu, uintptr_t fnc); void pEppriiiiiiiiilt__32(x64emu_t *emu, uintptr_t fnc); void vEEipp_32(x64emu_t *emu, uintptr_t fnc); @@ -1020,6 +1019,7 @@ void iFrpuu_Lui_32(x64emu_t *emu, uintptr_t fnc); void iEbp_bL_iS_32(x64emu_t *emu, uintptr_t fnc); void iFbp_bp_pi_32(x64emu_t *emu, uintptr_t fnc); void iFXbL_ibp__32(x64emu_t *emu, uintptr_t fnc); +void vFEpuBLLLL__32(x64emu_t *emu, uintptr_t fnc); void vFbp_ppbup__32(x64emu_t *emu, uintptr_t fnc); void vFXLbpLiL_L_32(x64emu_t *emu, uintptr_t fnc); void iFXLbpLiL_L_32(x64emu_t *emu, uintptr_t fnc); @@ -1028,6 +1028,7 @@ void iEuirLL_BLL__32(x64emu_t *emu, uintptr_t fnc); void iFXLpbLWWWcc__32(x64emu_t *emu, uintptr_t fnc); void iFXLbLWWWcc_i_32(x64emu_t *emu, uintptr_t fnc); void pESBppppii_pi_32(x64emu_t *emu, uintptr_t fnc); +void iFEprllll_rll__32(x64emu_t *emu, uintptr_t fnc); void iFXLuriiiiiLi__32(x64emu_t *emu, uintptr_t fnc); void vFXLbLLLLLLLLLL_L_32(x64emu_t *emu, uintptr_t fnc); void iFXLbLLLLLLLLLL_L_32(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped32/wrappedfreetype.c b/src/wrapped32/wrappedfreetype.c index 2823f9ae..fa1e69dd 100644 --- a/src/wrapped32/wrappedfreetype.c +++ b/src/wrapped32/wrappedfreetype.c @@ -17,6 +17,7 @@ #include "box32context.h" #include "emu/x64emu_private.h" #include "myalign32.h" +#include "converter32.h" static const char* freetypeName = #ifdef ANDROID @@ -29,6 +30,8 @@ static const char* freetypeName = typedef void (*vFp_t)(void*); +#define FT_GLYPH_FORMAT_OUTLINE (('o'<<24)|('u'<<16)|('t'<<8)|'l') +#define FT_GLYPH_FORMAT_BITMAP (('b'<<24)|('i'<<16)|('t'<<8)|'s') // 64bits FreeType structures typedef union FT_StreamDesc_s @@ -327,6 +330,173 @@ typedef struct FT_Matrix_s long yx, yy; } FT_Matrix_t; +typedef struct FT_GlyphRec_s +{ + void* library; //FT_Library + void* clazz; //const FT_Glyph_Class* + uint32_t format; + FT_Vector_t advance; +} FT_GlyphRec_t; + +typedef struct FT_BitmapGlyphRec_s +{ + FT_GlyphRec_t root; + int left; + int top; + FT_Bitmap_t bitmap; +} FT_BitmapGlyphRec_t; + +typedef struct TT_Header_s +{ + signed long Table_Version; + signed long Font_Revision; + long CheckSum_Adjust; + long Magic_Number; + uint16_t Flags; + uint16_t Units_Per_EM; + unsigned long Created [2]; + unsigned long Modified[2]; + int16_t xMin; + int16_t yMin; + int16_t xMax; + int16_t yMax; + uint16_t Mac_Style; + uint16_t Lowest_Rec_PPEM; + int16_t Font_Direction; + int16_t Index_To_Loc_Format; + int16_t Glyph_Data_Format; +} TT_Header_t; +typedef struct TT_MaxProfile_s +{ + signed long version; + uint16_t numGlyphs; + uint16_t maxPoints; + uint16_t maxContours; + uint16_t maxCompositePoints; + uint16_t maxCompositeContours; + uint16_t maxZones; + uint16_t maxTwilightPoints; + uint16_t maxStorage; + uint16_t maxFunctionDefs; + uint16_t maxInstructionDefs; + uint16_t maxStackElements; + uint16_t maxSizeOfInstructions; + uint16_t maxComponentElements; + uint16_t maxComponentDepth; +} TT_MaxProfile_t; +typedef struct TT_OS2_s +{ + uint16_t version; + int16_t xAvgCharWidth; + uint16_t usWeightClass; + uint16_t usWidthClass; + uint16_t fsType; + int16_t ySubscriptXSize; + int16_t ySubscriptYSize; + int16_t ySubscriptXOffset; + int16_t ySubscriptYOffset; + int16_t ySuperscriptXSize; + int16_t ySuperscriptYSize; + int16_t ySuperscriptXOffset; + int16_t ySuperscriptYOffset; + int16_t yStrikeoutSize; + int16_t yStrikeoutPosition; + int16_t sFamilyClass; + uint8_t panose[10]; + unsigned long ulUnicodeRange1; + unsigned long ulUnicodeRange2; + unsigned long ulUnicodeRange3; + unsigned long ulUnicodeRange4; + signed char achVendID[4]; + uint16_t fsSelection; + uint16_t usFirstCharIndex; + uint16_t usLastCharIndex; + int16_t sTypoAscender; + int16_t sTypoDescender; + int16_t sTypoLineGap; + uint16_t usWinAscent; + uint16_t usWinDescent; + /* only version 1 and higher: */ + unsigned long ulCodePageRange1; + unsigned long ulCodePageRange2; + /* only version 2 and higher: */ + int16_t sxHeight; + int16_t sCapHeight; + uint16_t usDefaultChar; + uint16_t usBreakChar; + uint16_t usMaxContext; + /* only version 5 and higher: */ + uint16_t usLowerOpticalPointSize; + uint16_t usUpperOpticalPointSize; +} TT_OS2_t; +typedef struct TT_HoriHeader_s +{ + signed long Version; + int16_t Ascender; + int16_t Descender; + int16_t Line_Gap; + uint16_t advance_Width_Max; + int16_t min_Left_Side_Bearing; + int16_t min_Right_Side_Bearing; + int16_t xMax_Extent; + int16_t caret_Slope_Rise; + int16_t caret_Slope_Run; + int16_t caret_Offset; + int16_t Reserved[4]; + int16_t metric_Data_Format; + uint16_t number_Of_HMetrics; + void* long_metrics; + void* short_metrics; +} TT_HoriHeader_t; +typedef struct TT_VertHeader_s +{ + signed long Version; + int16_t Ascender; + int16_t Descender; + int16_t Line_Gap; + uint16_t advance_Height_Max; + int16_t min_Top_Side_Bearing; + int16_t min_Bottom_Side_Bearing; + int16_t yMax_Extent; + int16_t caret_Slope_Rise; + int16_t caret_Slope_Run; + int16_t caret_Offset; + int16_t Reserved[4]; + int16_t metric_Data_Format; + uint16_t number_Of_VMetrics; + void* long_metrics; + void* short_metrics; +} TT_VertHeader_t; +typedef struct TT_Postscript_s +{ + signed long FormatType; + signed long italicAngle; + int16_t underlinePosition; + int16_t underlineThickness; + unsigned long isFixedPitch; + unsigned long minMemType42; + unsigned long maxMemType42; + unsigned long minMemType1; + unsigned long maxMemType1; +} TT_Postscript_t; +typedef struct TT_PCLT_s +{ + signed long Version; + unsigned long FontNumber; + uint16_t Pitch; + uint16_t xHeight; + uint16_t Style; + uint16_t TypeFamily; + uint16_t CapHeight; + uint16_t SymbolSet; + signed char TypeFace[16]; + signed char CharacterComplement[8]; + signed char FileName[6]; + signed char StrokeWeight; + signed char WidthType; + uint8_t SerifStyle; + uint8_t Reserved; +} TT_PCLT_t; // =============================================== // 32bits FreeType structures // =============================================== @@ -630,6 +800,173 @@ typedef struct __attribute__((packed, aligned(4))) FT_Matrix_32_s long_t yx, yy; } FT_Matrix_32_t; +typedef struct __attribute__((packed, aligned(4))) FT_GlyphRec_32_s +{ + ptr_t library; //FT_Library + ptr_t clazz; //const FT_Glyph_Class* + uint32_t format; + FT_Vector_32_t advance; +} FT_GlyphRec_32_t; + +typedef struct FT_BitmapGlyphRec_32_s +{ + FT_GlyphRec_32_t root; + int left; + int top; + FT_Bitmap_32_t bitmap; +} FT_BitmapGlyphRec_32_t; +typedef struct TT_Header_32_s //no align +{ + long_t Table_Version; + long_t Font_Revision; + long_t CheckSum_Adjust; + long_t Magic_Number; + uint16_t Flags; + uint16_t Units_Per_EM; + ulong_t Created [2]; + ulong_t Modified[2]; + int16_t xMin; + int16_t yMin; + int16_t xMax; + int16_t yMax; + uint16_t Mac_Style; + uint16_t Lowest_Rec_PPEM; + int16_t Font_Direction; + int16_t Index_To_Loc_Format; + int16_t Glyph_Data_Format; +} TT_Header_32_t; +typedef struct TT_MaxProfile_32_s //no align +{ + long_t version; + uint16_t numGlyphs; + uint16_t maxPoints; + uint16_t maxContours; + uint16_t maxCompositePoints; + uint16_t maxCompositeContours; + uint16_t maxZones; + uint16_t maxTwilightPoints; + uint16_t maxStorage; + uint16_t maxFunctionDefs; + uint16_t maxInstructionDefs; + uint16_t maxStackElements; + uint16_t maxSizeOfInstructions; + uint16_t maxComponentElements; + uint16_t maxComponentDepth; +} TT_MaxProfile_32_t; +typedef struct TT_OS2_32_s //no align +{ + uint16_t version; + int16_t xAvgCharWidth; + uint16_t usWeightClass; + uint16_t usWidthClass; + uint16_t fsType; + int16_t ySubscriptXSize; + int16_t ySubscriptYSize; + int16_t ySubscriptXOffset; + int16_t ySubscriptYOffset; + int16_t ySuperscriptXSize; + int16_t ySuperscriptYSize; + int16_t ySuperscriptXOffset; + int16_t ySuperscriptYOffset; + int16_t yStrikeoutSize; + int16_t yStrikeoutPosition; + int16_t sFamilyClass; + uint8_t panose[10]; + ulong_t ulUnicodeRange1; + ulong_t ulUnicodeRange2; + ulong_t ulUnicodeRange3; + ulong_t ulUnicodeRange4; + signed char achVendID[4]; + uint16_t fsSelection; + uint16_t usFirstCharIndex; + uint16_t usLastCharIndex; + int16_t sTypoAscender; + int16_t sTypoDescender; + int16_t sTypoLineGap; + uint16_t usWinAscent; + uint16_t usWinDescent; + /* only version 1 and higher: */ + ulong_t ulCodePageRange1; + ulong_t ulCodePageRange2; + /* only version 2 and higher: */ + int16_t sxHeight; + int16_t sCapHeight; + uint16_t usDefaultChar; + uint16_t usBreakChar; + uint16_t usMaxContext; + /* only version 5 and higher: */ + uint16_t usLowerOpticalPointSize; + uint16_t usUpperOpticalPointSize; +} TT_OS2_32_t; +typedef struct TT_HoriHeader_32_s //no align +{ + long_t Version; + int16_t Ascender; + int16_t Descender; + int16_t Line_Gap; + uint16_t advance_Width_Max; + int16_t min_Left_Side_Bearing; + int16_t min_Right_Side_Bearing; + int16_t xMax_Extent; + int16_t caret_Slope_Rise; + int16_t caret_Slope_Run; + int16_t caret_Offset; + int16_t Reserved[4]; + int16_t metric_Data_Format; + uint16_t number_Of_HMetrics; + ptr_t long_metrics; + ptr_t short_metrics; +} TT_HoriHeader_32_t; +typedef struct TT_VertHeader_32_s //no align +{ + long_t Version; + int16_t Ascender; + int16_t Descender; + int16_t Line_Gap; + uint16_t advance_Height_Max; + int16_t min_Top_Side_Bearing; + int16_t min_Bottom_Side_Bearing; + int16_t yMax_Extent; + int16_t caret_Slope_Rise; + int16_t caret_Slope_Run; + int16_t caret_Offset; + int16_t Reserved[4]; + int16_t metric_Data_Format; + uint16_t number_Of_VMetrics; + ptr_t long_metrics; + ptr_t short_metrics; +} TT_VertHeader_32_t; +typedef struct TT_Postscript_32_s //no align +{ + long_t FormatType; + long_t italicAngle; + int16_t underlinePosition; + int16_t underlineThickness; + ulong_t isFixedPitch; + ulong_t minMemType42; + ulong_t maxMemType42; + ulong_t minMemType1; + ulong_t maxMemType1; +} TT_Postscript_32_t; +typedef struct TT_PCLT_32_s //no align +{ + long_t Version; + ulong_t FontNumber; + uint16_t Pitch; + uint16_t xHeight; + uint16_t Style; + uint16_t TypeFamily; + uint16_t CapHeight; + uint16_t SymbolSet; + signed char TypeFace[16]; + signed char CharacterComplement[8]; + signed char FileName[6]; + signed char StrokeWeight; + signed char WidthType; + uint8_t SerifStyle; + uint8_t Reserved; +} TT_PCLT_32_t; + // ================================== // Convertions // ================================== @@ -1175,6 +1512,294 @@ void convert_FT_Bitmap_to_64(void* d, void* s) dst->rows = src->rows; } +void convert_FT_Outline_to_32(void* d, void* s) +{ + if(!s || !d) return; + FT_Outline_t* src = s; + FT_Outline_32_t* dst = d; + + dst->n_contours = src->n_contours; + dst->n_points = src->n_points; + dst->points = to_ptrv(src->points); + dst->tags = to_ptrv(src->tags); + dst->contours = to_ptrv(src->contours); + dst->flags = src->flags; + int n = dst->n_points; + FT_Vector_32_t* vec = from_ptrv(dst->points); + for(int i=0; i<n; ++i) { + vec[i].x = to_long(src->points[i].x); + vec[i].y = to_long(src->points[i].y); + } +} + +void convert_FT_Outline_to_64(void* d, void* s) +{ + if(!s || !d) return; + FT_Outline_32_t* src = s; + FT_Outline_t* dst = d; + + dst->flags = src->flags; + dst->contours = from_ptrv(src->contours); + dst->tags = from_ptrv(src->tags); + dst->points = from_ptrv(src->points); + dst->n_points = src->n_points; + dst->n_contours = src->n_contours; + int n = dst->n_points; + FT_Vector_32_t* vec = (FT_Vector_32_t*)dst->points; + for(int i=n-1; i>=0; --i) { + dst->points[i].x = from_long(vec[i].x); + dst->points[i].y = from_long(vec[i].y); + } +} + +void inplace_FT_Glyph_shrink(void* a) +{ + if(!a) + return; + + FT_GlyphRec_t* src = a; + FT_GlyphRec_32_t* dst = a; + + dst->library = to_ptrv(src->library); + dst->clazz = to_ptrv(src->clazz); + dst->format = src->format; + dst->advance.x = to_long(src->advance.x); + dst->advance.y = to_long(src->advance.y); + + if(dst->format == FT_GLYPH_FORMAT_OUTLINE) { + FT_Outline_t* src_o = (FT_Outline_t*)(src+1); + FT_Outline_32_t* dst_o = (FT_Outline_32_t*)(dst+1); + + convert_FT_Outline_to_32(dst_o, src_o); + } else if(dst->format == FT_GLYPH_FORMAT_BITMAP) { + FT_BitmapGlyphRec_t* src_b = a; + FT_BitmapGlyphRec_32_t* dst_b = a; + + dst_b->left = src_b->left; + dst_b->top = src_b->top; + convert_FT_Bitmap_to_32(&dst_b->bitmap, &src_b->bitmap); + } else { + printf_log(LOG_NONE, "BOX32: Warning, unsupported glyph format 0x%x (%c%c%c%c)\n", dst->format, dst->format>>24, (dst->format>>16)&0xff, (dst->format>>8)&0xff, dst->format&0xff); + } +} + +void inplace_FT_Glyph_enlarge(void* a) +{ + if(!a) + return; + + FT_GlyphRec_32_t* src = a; + FT_GlyphRec_t* dst = a; + + dst->advance.y = from_long(src->advance.y); + dst->advance.x = from_long(src->advance.x); + dst->format = src->format; + dst->clazz = from_ptrv(src->clazz); + dst->library = from_ptrv(src->library); + + if(dst->format == FT_GLYPH_FORMAT_OUTLINE) { + FT_Outline_t* dst_o = (FT_Outline_t*)(dst+1); + FT_Outline_32_t* src_o = (FT_Outline_32_t*)(src+1); + + convert_FT_Outline_to_64(dst_o, src_o); + } else if(dst->format == FT_GLYPH_FORMAT_BITMAP) { + FT_BitmapGlyphRec_32_t* src_b = a; + FT_BitmapGlyphRec_t* dst_b = a; + + convert_FT_Bitmap_to_64(&dst_b->bitmap, &src_b->bitmap); + dst_b->top = src_b->top; + dst_b->left = src_b->left; + } +} + +void convert_TT_Header_to_32(void* d, void* s) +{ + if(!s || !d) return; + TT_Header_t* src = s; + TT_Header_32_t* dst = d; + + dst->Table_Version = to_long(src->Table_Version); + dst->Font_Revision = to_long(src->Font_Revision); + dst->CheckSum_Adjust = to_long(src->CheckSum_Adjust); + dst->Magic_Number = to_long(src->Magic_Number); + dst->Flags = src->Flags; + dst->Units_Per_EM = src->Units_Per_EM; + dst->Created [0] = to_ulong(src->Created[0]); + dst->Created [1] = to_ulong(src->Created[1]); + dst->Modified[0] = to_ulong(src->Modified[0]); + dst->Modified[1] = to_ulong(src->Modified[1]); + dst->xMin = src->xMin; + dst->yMin = src->yMin; + dst->xMax = src->xMax; + dst->yMax = src->yMax; + dst->Mac_Style = src->Mac_Style; + dst->Lowest_Rec_PPEM = src->Lowest_Rec_PPEM; + dst->Font_Direction = src->Font_Direction; + dst->Index_To_Loc_Format = src->Index_To_Loc_Format; + dst->Glyph_Data_Format = src->Glyph_Data_Format; +} +void convert_TT_MaxProfile_to_32(void* d, void* s) +{ + if(!s || !d) return; + TT_MaxProfile_t* src = s; + TT_MaxProfile_32_t* dst = d; + + dst->version = to_long(src->version); + dst->numGlyphs = src->numGlyphs; + dst->maxPoints = src->maxPoints; + dst->maxContours = src->maxContours; + dst->maxCompositePoints = src->maxCompositePoints; + dst->maxCompositeContours = src->maxCompositeContours; + dst->maxZones = src->maxZones; + dst->maxTwilightPoints = src->maxTwilightPoints; + dst->maxStorage = src->maxStorage; + dst->maxFunctionDefs = src->maxFunctionDefs; + dst->maxInstructionDefs = src->maxInstructionDefs; + dst->maxStackElements = src->maxStackElements; + dst->maxSizeOfInstructions = src->maxSizeOfInstructions; + dst->maxComponentElements = src->maxComponentElements; + dst->maxComponentDepth = src->maxComponentDepth; +} +void convert_TT_OS2_to_32(void* d, void* s) +{ + if(!s || !d) return; + TT_OS2_t* src = s; + TT_OS2_32_t* dst = d; + + dst->version = src->version; + dst->xAvgCharWidth = src->xAvgCharWidth; + dst->usWeightClass = src->usWeightClass; + dst->usWidthClass = src->usWidthClass; + dst->fsType = src->fsType; + dst->ySubscriptXSize = src->ySubscriptXSize; + dst->ySubscriptYSize = src->ySubscriptYSize; + dst->ySubscriptXOffset = src->ySubscriptXOffset; + dst->ySubscriptYOffset = src->ySubscriptYOffset; + dst->ySuperscriptXSize = src->ySuperscriptXSize; + dst->ySuperscriptYSize = src->ySuperscriptYSize; + dst->ySuperscriptXOffset = src->ySuperscriptXOffset; + dst->ySuperscriptYOffset = src->ySuperscriptYOffset; + dst->yStrikeoutSize = src->yStrikeoutSize; + dst->yStrikeoutPosition = src->yStrikeoutPosition; + dst->sFamilyClass = src->sFamilyClass; + for(int i=0; i<10; ++i) + dst->panose[i] = src->panose[i]; + dst->ulUnicodeRange1 = src->ulUnicodeRange1; + dst->ulUnicodeRange2 = src->ulUnicodeRange2; + dst->ulUnicodeRange3 = src->ulUnicodeRange3; + dst->ulUnicodeRange4 = src->ulUnicodeRange4; + for(int i=0; i<4; ++i) + dst->achVendID[i] = src->achVendID[i]; + dst->fsSelection = src->fsSelection; + dst->usFirstCharIndex = src->usFirstCharIndex; + dst->usLastCharIndex = src->usLastCharIndex; + dst->sTypoAscender = src->sTypoAscender; + dst->sTypoDescender = src->sTypoDescender; + dst->sTypoLineGap = src->sTypoLineGap; + dst->usWinAscent = src->usWinAscent; + dst->usWinDescent = src->usWinDescent; + if(dst->version<1) return; + dst->ulCodePageRange1 = to_ulong(src->ulCodePageRange1); + dst->ulCodePageRange2 = to_ulong(src->ulCodePageRange2); + if(dst->version<2) return; + dst->sxHeight = src->sxHeight; + dst->sCapHeight = src->sCapHeight; + dst->usDefaultChar = src->usDefaultChar; + dst->usBreakChar = src->usBreakChar; + dst->usMaxContext = src->usMaxContext; + if(dst->version<5) return; + dst->usLowerOpticalPointSize = src->usLowerOpticalPointSize; + dst->usUpperOpticalPointSize = src->usUpperOpticalPointSize; +} +void convert_TT_HoriHeader_to_32(void* d, void* s) +{ + if(!s || !d) return; + TT_HoriHeader_t* src = s; + TT_HoriHeader_32_t* dst = d; + + dst->Version = to_long(src->Version); + dst->Ascender = src->Ascender; + dst->Descender = src->Descender; + dst->Line_Gap = src->Line_Gap; + dst->advance_Width_Max = src->advance_Width_Max; + dst->min_Left_Side_Bearing = src->min_Left_Side_Bearing; + dst->min_Right_Side_Bearing = src->min_Right_Side_Bearing; + dst->xMax_Extent = src->xMax_Extent; + dst->caret_Slope_Rise = src->caret_Slope_Rise; + dst->caret_Slope_Run = src->caret_Slope_Run; + dst->caret_Offset = src->caret_Offset; + for(int i=0; i<4; ++i) + dst->Reserved[i] = src->Reserved[i]; + dst->metric_Data_Format = src->metric_Data_Format; + dst->number_Of_HMetrics = src->number_Of_HMetrics; + dst->long_metrics = to_ptrv(src->long_metrics); + dst->short_metrics = to_ptrv(src->short_metrics); +} +void convert_TT_VertHeader_to_32(void* d, void* s) +{ + if(!s || !d) return; + TT_VertHeader_t* src = s; + TT_VertHeader_32_t* dst = d; + + dst->Version = to_long(src->Version); + dst->Ascender = src->Ascender; + dst->Descender = src->Descender; + dst->Line_Gap = src->Line_Gap; + dst->advance_Height_Max = src->advance_Height_Max; + dst->min_Top_Side_Bearing = src->min_Top_Side_Bearing; + dst->min_Bottom_Side_Bearing = src->min_Bottom_Side_Bearing; + dst->yMax_Extent = src->yMax_Extent; + dst->caret_Slope_Rise = src->caret_Slope_Rise; + dst->caret_Slope_Run = src->caret_Slope_Run; + dst->caret_Offset = src->caret_Offset; + for(int i=0; i<4; ++i) + dst->Reserved[i] = src->Reserved[i]; + dst->metric_Data_Format = src->metric_Data_Format; + dst->number_Of_VMetrics = src->number_Of_VMetrics; + dst->long_metrics = to_ptrv(src->long_metrics); + dst->short_metrics = to_ptrv(src->short_metrics); +} +void convert_TT_Postscript_to_32(void* d, void* s) +{ + if(!s || !d) return; + TT_Postscript_t* src = s; + TT_Postscript_32_t* dst = d; + + dst->FormatType = to_long(src->FormatType); + dst->italicAngle = to_long(src->italicAngle); + dst->underlinePosition = src->underlinePosition; + dst->underlineThickness = src->underlineThickness; + dst->isFixedPitch = to_ulong(src->isFixedPitch); + dst->minMemType42 = to_ulong(src->minMemType42); + dst->maxMemType42 = to_ulong(src->maxMemType42); + dst->minMemType1 = to_ulong(src->minMemType1); + dst->maxMemType1 = to_ulong(src->maxMemType1); +} +void convert_TT_PCLT_to_32(void* d, void* s) +{ + if(!s || !d) return; + TT_PCLT_t* src = s; + TT_PCLT_32_t* dst = d; + + dst->Version = to_long(src->Version); + dst->FontNumber = to_ulong(src->FontNumber); + dst->Pitch = src->Pitch; + dst->xHeight = src->xHeight; + dst->Style = src->Style; + dst->TypeFamily = src->TypeFamily; + dst->CapHeight = src->CapHeight; + dst->SymbolSet = src->SymbolSet; + for(int i=0; i<16; ++i) + dst->TypeFace[i] = src->TypeFace[i]; + for(int i=0; i<8; ++i) + dst->CharacterComplement[i] = src->CharacterComplement[i]; + for(int i=0; i<6; ++i) + dst->FileName[i] = src->FileName[i]; + dst->StrokeWeight = src->StrokeWeight; + dst->WidthType = src->WidthType; + dst->SerifStyle = src->SerifStyle; + dst->Reserved = src->Reserved; +} // ================================== // Wrapping // ================================== @@ -1639,6 +2264,24 @@ EXPORT void* my32_FT_Get_Sfnt_Table(x64emu_t* emu, void* face, int tag) inplace_FT_FaceRec_enlarge(face); void* ret = my->FT_Get_Sfnt_Table(face, tag); inplace_FT_FaceRec_shrink(face); + if(!ret) return ret; + static TT_Header_32_t tt_head = {0}; + static TT_MaxProfile_32_t tt_max = {0}; + static TT_OS2_32_t tt_os2 = {0}; + static TT_HoriHeader_32_t tt_hori = {0}; + static TT_VertHeader_32_t tt_vert = {0}; + static TT_Postscript_32_t tt_post = {0}; + static TT_PCLT_32_t tt_pclt = {0}; + switch(tag) { + case 0: convert_TT_Header_to_32(&tt_head, ret); return &tt_head; + case 1: convert_TT_MaxProfile_to_32(&tt_max, ret); return &tt_max; + case 2: convert_TT_OS2_to_32(&tt_os2, ret); return &tt_os2; + case 3: convert_TT_HoriHeader_to_32(&tt_hori, ret); return &tt_hori; + case 4: convert_TT_VertHeader_to_32(&tt_vert, ret); return &tt_vert; + case 5: convert_TT_Postscript_to_32(&tt_post, ret); return &tt_post; + case 6: convert_TT_PCLT_to_32(&tt_pclt, ret); return &tt_pclt; + } + printf_log(LOG_NONE, "BOX32: Warning, unsupported type %d for FT_Get_Sfnt_Table\n", tag); return ret; } @@ -1770,23 +2413,9 @@ EXPORT int my32_FT_Set_Charmap(x64emu_t* emu, void* face, void* charmap) EXPORT void my32_FT_Outline_Get_CBox(x64emu_t* emu, FT_Outline_32_t* outline, FT_BBox_32_t* bbox) { - // convert outline to 64 - int n = outline->n_points; - FT_Outline_t outline_l; - FT_Vector_t vector[n]; - outline_l.n_contours = outline->n_contours; - outline_l.n_points = outline->n_points; - outline_l.points = vector; - FT_Vector_32_t* vec = from_ptrv(outline->points); - for(int i=0; i<n; ++i) { - vector[i].x = from_long(vec[i].x); - vector[i].y = from_long(vec[i].y); - } - outline_l.tags = from_ptrv(outline->tags); - outline_l.contours = from_ptrv(outline->contours); - outline_l.flags = outline->flags; - // + FT_Outline_t outline_l = {0}; FT_BBox_t res = {0}; + convert_FT_Outline_to_64(&outline_l, outline); my->FT_Outline_Get_CBox(&outline_l, &res); bbox->xMin = to_long(res.xMin); bbox->yMin = to_long(res.yMin); @@ -1796,35 +2425,11 @@ EXPORT void my32_FT_Outline_Get_CBox(x64emu_t* emu, FT_Outline_32_t* outline, FT EXPORT int my32_FT_Outline_Copy(x64emu_t* emu, FT_Outline_32_t* source, FT_Outline_32_t* target) { - // convert outline to 64 - int n = source->n_points; - FT_Outline_t source_l, target_l; - FT_Vector_t vector[n]; - source_l.n_contours = source->n_contours; - source_l.n_points = source->n_points; - source_l.points = vector; - FT_Vector_32_t* vec = from_ptrv(source->points); - for(int i=0; i<n; ++i) { - vector[i].x = from_long(vec[i].x); - vector[i].y = from_long(vec[i].y); - } - source_l.tags = from_ptrv(source->tags); - source_l.contours = from_ptrv(source->contours); - source_l.flags = source->flags; - int ret = my->FT_Outline_Copy(&source_l, &target_l); - // inplace outline shrink - target->flags = target_l.flags; - target->contours = to_ptrv(target_l.contours); - target->tags = to_ptrv(target_l.tags); - target->points = to_ptrv(target_l.points); - target->n_points = target_l.n_points; - target->n_contours = target_l.n_contours; - n = target->n_points; - for(int i=n-1; i>=0; --i) { - vector[i].x = to_long(vec[i].x); - vector[i].y = to_long(vec[i].y); - } - /// + FT_Outline_t source_l = {0}, target_l = {0}; + convert_FT_Outline_to_64(&source_l, source); + convert_FT_Outline_to_64(&target_l, target); + int ret = my->FT_Outline_Copy(source, target); + convert_FT_Outline_to_32(target, &target_l); return ret; } @@ -1866,173 +2471,54 @@ EXPORT void my32_FT_Matrix_Multiply(x64emu_t* emu, FT_Matrix_32_t* a, FT_Matrix_ EXPORT int my32_FT_Outline_Get_Bitmap(x64emu_t* emu, void* lib, FT_Outline_32_t* outline, FT_Bitmap_32_t* bitmap) { - FT_Bitmap_t bitmap_l; - // convert outline to 64 - int n = outline->n_points; - FT_Outline_t outline_l; - FT_Vector_t vector[n]; - outline_l.n_contours = outline->n_contours; - outline_l.n_points = outline->n_points; - outline_l.points = vector; - FT_Vector_32_t* vec = from_ptrv(outline->points); - for(int i=0; i<n; ++i) { - vector[i].x = from_long(vec[i].x); - vector[i].y = from_long(vec[i].y); - } - outline_l.tags = from_ptrv(outline->tags); - outline_l.contours = from_ptrv(outline->contours); - outline_l.flags = outline->flags; - // + FT_Bitmap_t bitmap_l = {0}; + FT_Outline_t outline_l = {0}; + convert_FT_Outline_to_64(&outline_l, outline); convert_FT_Bitmap_to_64(&bitmap_l, bitmap); - int ret = my->FT_Outline_Get_Bitmap(lib, &outline_l, &bitmap_l); convert_FT_Bitmap_to_32(bitmap, &bitmap_l); + convert_FT_Outline_to_32(outline, &outline_l); //usefull? return ret; } EXPORT void my32_FT_Outline_Transform(x64emu_t* emu, FT_Outline_32_t* outline, FT_Matrix_32_t* matrix) { - FT_Matrix_t matrix_l; - // convert outline to 64 - int n = outline->n_points; - FT_Outline_t outline_l; - FT_Vector_t vector[n]; - outline_l.n_contours = outline->n_contours; - outline_l.n_points = outline->n_points; - outline_l.points = vector; - FT_Vector_32_t* vec = from_ptrv(outline->points); - for(int i=0; i<n; ++i) { - vector[i].x = from_long(vec[i].x); - vector[i].y = from_long(vec[i].y); - } - outline_l.tags = from_ptrv(outline->tags); - outline_l.contours = from_ptrv(outline->contours); - outline_l.flags = outline->flags; - // + FT_Matrix_t matrix_l = {0}; + FT_Outline_t outline_l = {0}; + convert_FT_Outline_to_64(&outline_l, outline); convert_FT_Matrix_to_64(&matrix_l, matrix); my->FT_Outline_Transform(&outline_l, &matrix_l); - // convert outline to 32 - outline->n_contours = outline_l.n_contours; - outline->n_points = outline_l.n_points; - for(int i=0; i<n; ++i) { - vec[i].x = to_long(vector[i].x); - vec[i].y = to_long(vector[i].y); - } - outline->tags = to_ptrv(outline_l.tags); - outline->contours = to_ptrv(outline_l.contours); - outline->flags = outline_l.flags; + convert_FT_Outline_to_32(outline, &outline_l); } EXPORT void my32_FT_Outline_Translate(x64emu_t* emu, FT_Outline_32_t* outline, long x, long y) { - // convert outline to 64 - int n = outline->n_points; - FT_Outline_t outline_l; - FT_Vector_t vector[n]; - outline_l.n_contours = outline->n_contours; - outline_l.n_points = outline->n_points; - outline_l.points = vector; - FT_Vector_32_t* vec = from_ptrv(outline->points); - for(int i=0; i<n; ++i) { - vector[i].x = from_long(vec[i].x); - vector[i].y = from_long(vec[i].y); - } - outline_l.tags = from_ptrv(outline->tags); - outline_l.contours = from_ptrv(outline->contours); - outline_l.flags = outline->flags; - // + FT_Outline_t outline_l = {0}; + convert_FT_Outline_to_64(&outline_l, outline); my->FT_Outline_Translate(&outline_l, x, y); - // convert outline to 32 - outline->n_contours = outline_l.n_contours; - outline->n_points = outline_l.n_points; - for(int i=0; i<n; ++i) { - vec[i].x = to_long(vector[i].x); - vec[i].y = to_long(vector[i].y); - } - outline->tags = to_ptrv(outline_l.tags); - outline->contours = to_ptrv(outline_l.contours); - outline->flags = outline_l.flags; + convert_FT_Outline_to_32(outline, &outline_l); } EXPORT void my32_FT_Outline_Embolden(x64emu_t* emu, FT_Outline_32_t* outline, long strength) { - // convert outline to 64 - int n = outline->n_points; - FT_Outline_t outline_l; - FT_Vector_t vector[n]; - outline_l.n_contours = outline->n_contours; - outline_l.n_points = outline->n_points; - outline_l.points = vector; - FT_Vector_32_t* vec = from_ptrv(outline->points); - for(int i=0; i<n; ++i) { - vector[i].x = from_long(vec[i].x); - vector[i].y = from_long(vec[i].y); - } - outline_l.tags = from_ptrv(outline->tags); - outline_l.contours = from_ptrv(outline->contours); - outline_l.flags = outline->flags; - // + FT_Outline_t outline_l = {0}; + convert_FT_Outline_to_64(&outline_l, outline); my->FT_Outline_Embolden(&outline_l, strength); - // convert outline to 32 - outline->n_contours = outline_l.n_contours; - outline->n_points = outline_l.n_points; - for(int i=0; i<n; ++i) { - vec[i].x = to_long(vector[i].x); - vec[i].y = to_long(vector[i].y); - } - outline->tags = to_ptrv(outline_l.tags); - outline->contours = to_ptrv(outline_l.contours); - outline->flags = outline_l.flags; + convert_FT_Outline_to_32(outline, &outline_l); } EXPORT void my32_FT_Outline_EmboldenXY(x64emu_t* emu, FT_Outline_32_t* outline, long xstrength, long ystrength) { - // convert outline to 64 - int n = outline->n_points; - FT_Outline_t outline_l; - FT_Vector_t vector[n]; - outline_l.n_contours = outline->n_contours; - outline_l.n_points = outline->n_points; - outline_l.points = vector; - FT_Vector_32_t* vec = from_ptrv(outline->points); - for(int i=0; i<n; ++i) { - vector[i].x = from_long(vec[i].x); - vector[i].y = from_long(vec[i].y); - } - outline_l.tags = from_ptrv(outline->tags); - outline_l.contours = from_ptrv(outline->contours); - outline_l.flags = outline->flags; - // + FT_Outline_t outline_l = {0}; + convert_FT_Outline_to_64(&outline_l, outline); my->FT_Outline_EmboldenXY(&outline_l, xstrength, ystrength); - // convert outline to 32 - outline->n_contours = outline_l.n_contours; - outline->n_points = outline_l.n_points; - for(int i=0; i<n; ++i) { - vec[i].x = to_long(vector[i].x); - vec[i].y = to_long(vector[i].y); - } - outline->tags = to_ptrv(outline_l.tags); - outline->contours = to_ptrv(outline_l.contours); - outline->flags = outline_l.flags; + convert_FT_Outline_to_32(outline, &outline_l); } EXPORT int my32_FT_Outline_Decompose(x64emu_t* emu, FT_Outline_32_t* outline, my_FT_Outline_Funcs_t* tbl, void* data) { - // convert outline to 64 - int n = outline->n_points; - FT_Outline_t outline_l; - FT_Vector_t vector[n]; - outline_l.n_contours = outline->n_contours; - outline_l.n_points = outline->n_points; - outline_l.points = vector; - FT_Vector_32_t* vec = from_ptrv(outline->points); - for(int i=0; i<n; ++i) { - vector[i].x = from_long(vec[i].x); - vector[i].y = from_long(vec[i].y); - } - outline_l.tags = from_ptrv(outline->tags); - outline_l.contours = from_ptrv(outline->contours); - outline_l.flags = outline->flags; + FT_Outline_t outline_l = {0}; + convert_FT_Outline_to_64(&outline_l, outline); // my_FT_Outline_Funcs_t f = {0}; if(tbl) { @@ -2043,33 +2529,16 @@ EXPORT int my32_FT_Outline_Decompose(x64emu_t* emu, FT_Outline_32_t* outline, my f.shift = tbl->shift; f.delta = tbl->delta; } - int ret = my->FT_Outline_Decompose(outline, tbl?(&f):tbl, data); - // convert outline to 32 - outline->n_contours = outline_l.n_contours; - outline->n_points = outline_l.n_points; - for(int i=0; i<n; ++i) { - vec[i].x = to_long(vector[i].x); - vec[i].y = to_long(vector[i].y); - } - outline->tags = to_ptrv(outline_l.tags); - outline->contours = to_ptrv(outline_l.contours); - outline->flags = outline_l.flags; + int ret = my->FT_Outline_Decompose(&outline_l, tbl?(&f):tbl, data); + convert_FT_Outline_to_32(outline, &outline_l); return ret; } EXPORT int my32_FT_Outline_Done(x64emu_t* emu, void* library, FT_Outline_32_t* outline) { - // convert outline to 64 - int n = outline->n_points; - FT_Outline_t outline_l; - FT_Vector_t vector[n]; - outline_l.n_contours = outline->n_contours; - outline_l.n_points = outline->n_points; - outline_l.points = from_ptrv(outline->points); - outline_l.tags = from_ptrv(outline->tags); - outline_l.contours = from_ptrv(outline->contours); - outline_l.flags = outline->flags; - int ret = my->FT_Outline_Done(library, outline); + FT_Outline_t outline_l = {0}; + convert_FT_Outline_to_64(&outline_l, outline); + int ret = my->FT_Outline_Done(library, &outline_l); return ret; } @@ -2077,13 +2546,7 @@ EXPORT int my32_FT_Outline_New(x64emu_t* emu, void* library, uint32_t numPoints, { FT_Outline_t outline_l = {0}; int ret = my->FT_Outline_New(library, numPoints, numContours, &outline_l); - // convert outline to 32 - outline->n_contours = outline_l.n_contours; - outline->n_points = outline_l.n_points; - outline->points = to_ptrv(outline_l.points); - outline->tags = to_ptrv(outline_l.tags); - outline->contours = to_ptrv(outline_l.contours); - outline->flags = outline_l.flags; + convert_FT_Outline_to_32(outline, &outline_l); return ret; } @@ -2127,7 +2590,38 @@ EXPORT int my32_FT_Get_Glyph(x64emu_t* emu, FT_GlyphSlotRec_32_t* slot, ptr_t* g int ret = my->FT_Get_Glyph(&slot_l, &glyph_l); *glyph = to_ptrv(glyph_l); convert_FT_GlyphSlot_to_32(slot, &slot_l); + inplace_FT_Glyph_shrink(glyph_l); return ret; } +EXPORT int my32_FT_Glyph_Copy(x64emu_t* emu, void* src, void** dst) +{ + inplace_FT_Glyph_enlarge(src); + int ret = my->FT_Glyph_Copy(src, (void*)dst); + inplace_FT_Glyph_shrink(src); + inplace_FT_Glyph_shrink(*dst); + return ret; +} + +EXPORT void my32_FT_Glyph_Get_CBox(x64emu_t* emu, void* glyph, uint32_t mode, void* bbox) +{ + inplace_FT_Glyph_enlarge(glyph); + my->FT_Glyph_Get_CBox(glyph, mode, bbox); + inplace_FT_Glyph_shrink(glyph); +} + +EXPORT int my32_FT_Glyph_Transform(x64emu_t* emu, void* glyph, void* mat, void* vec) +{ + inplace_FT_Glyph_enlarge(glyph); + int ret = my->FT_Glyph_Transform(glyph, mat, vec); + inplace_FT_Glyph_shrink(glyph); + return ret; +} + +EXPORT void my32_FT_Done_Glyph(x64emu_t* emu, void* glyph) +{ + inplace_FT_FaceRec_enlarge(glyph); + my->FT_Done_Glyph(glyph); +} + #include "wrappedlib_init32.h" diff --git a/src/wrapped32/wrappedfreetype_private.h b/src/wrapped32/wrappedfreetype_private.h index d688fc86..177f048c 100644 --- a/src/wrapped32/wrappedfreetype_private.h +++ b/src/wrapped32/wrappedfreetype_private.h @@ -24,7 +24,7 @@ GO(FT_Cos, lFl) GO(FT_DivFix, lFll) GOM(FT_Done_Face, iFEp) GO(FT_Done_FreeType, iFp) -GO(FT_Done_Glyph, vFp) +GOM(FT_Done_Glyph, vFEp) //GO(FT_Done_Library, iFp) //GO(FT_Done_MM_Var, iFpp) GOM(FT_Done_Size, iFEp) @@ -87,15 +87,15 @@ GO(FT_Get_TrueType_Engine_Type, uFp) //GO(FT_Get_Var_Design_Coordinates, GOM(FT_Get_WinFNT_Header, iFEpp) GOM(FT_Get_X11_Font_Format, pFEp) -GO(FT_Glyph_Copy, iFpp) -GO(FT_Glyph_Get_CBox, vFpuBLLLL_) +GOM(FT_Glyph_Copy, iFEpBp_) +GOM(FT_Glyph_Get_CBox, vFEpuBLLLL_) //GO(FT_GlyphSlot_Embolden, vFp) //GO(FT_GlyphSlot_Oblique, vFp) //GO(FT_GlyphSlot_Own_Bitmap, iFp) //GO(FT_Glyph_Stroke, iFppC) //GO(FT_Glyph_StrokeBorder, iFppCC) //GO(FT_Glyph_To_Bitmap, iFpupC) -GO(FT_Glyph_Transform, iFprllll_rll_) +GOM(FT_Glyph_Transform, iFEprllll_rll_) //GO(FT_Gzip_Uncompress, GOM(FT_Has_PS_Glyph_Names, iFEp) GO(FT_Init_FreeType, iFBp_) |