Re: [ft-devel] How to map a char to glyph with pcf
Thanks very much. I use my own method to do this mapping, it works well... I just to want to how does freetype2 to deal with this. Thank you again. I will leave my code unchanged. I will dig the code more later. duhuanpeng ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
[ft-devel] do i find a typo in ftobjs.h
Hi, Is this a typo? Is it typecast? File: include/freetype/internal/ftobjs.h Line: 158 > } FT_CMapRec; > > /* typecase any pointer to a charmap handle */ > #define FT_CMAP( x ) ( (FT_CMap)( x ) ) > > /* obvious macros */ > #define FT_CMAP_PLATFORM_ID( x ) FT_CMAP( x )->charmap.platform_id duhuanpeng ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] How to map a char to glyph with pcf
Hi, my Korean text is encoded in ecu format in a array like: const char textkr[] = "\xb4\xeb\xc7\xd1\xb9\xce\xb1\xb9\x20\xc1\xa4\xba\xce\xb8\xa6\x20" "\xc7\xd1\x20\xb9\xf8\xbf\xa1\x20\xb8\xb8\xb3\xaa\xb4\xc2\x20\xc5" "\xeb\xc7\xd5\xc3\xa2\xb1\xb8"; Now I have make three trick to map "EUC encoded char" to "Glyph Index" in the pcf: [link 1] https://paste.ubuntu.com/p/dT7Yg3kYZt/ my code is based on thie document: [link 2] https://www.itscj.ipsj.or.jp/iso-ir/149.pdf I was sorry I didn't explain my problem clearly. I want to know if freetype2 have Done this mapping(step [3]) in the library? Or I have to write extra code for support it?[link 1] [1] char buf[2]="\xb4\xeb"; [2] buf &= 0x7F; buf -= 0x20; [3] buf --> Glyph Index duhuanpeng >Yes, of course – IIRC I've mentioned already in a previous e-mail that you >need `iconv'... Do you mean translate "Unicode" --> "EUC" like : $ ls /usr/share/fonts/X11/encodings/ Thanks for this information. You have to use function `FT_Get_BDF_Property' to extract the `CHARSET_REGISTRY' and `CHARSET_ENCODING' fields from your PCF font. Using this information you can set up, say, function `iconv' to map from Unicode to the font's cmap. Using FT2_DEBUG=any:7 ftdump gothic14.pcf.Z I see CHARSET_REGISTRY: `KSC5601.1987' CHARSET_ENCODING: `0' in the debug messages. The characters in the font are indeed encoded as plain KSC5601. A standard `iconv' call doesn't support this out of the box, I think; you have to convert this to the EUC-KR form by adding 0x8080 to each code point (e.g. 0x2121 -> 0xA1A1).[1] This reminds me of good, old ISO-2022, with Emacs as the only editor that really supports it :-) Werner [1] https://en.wikipedia.org/wiki/Extended_Unix_Code ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] How to map a char to glyph with pcf
Hi, Suzuki, >oh, I wish if "ISO-2022-KR" is supported, although it would not >be so easy for the young people to relate KSC5601 with it. These mono pcf fonts still very useful in embedded devices. Some "smart" router, doorbell, Electric meter, tea pot, etc. duhuanpeng ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] [bug] --> [arm] Fix thumb2 inline assembly under LLVM.
> Stop flooding us with the information. You gave me the wrong information, I want to point it out. That is why I "flooding" the information. ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] [bug] --> [arm] Fix thumb2 inline assembly under LLVM.
Here is the Cortex-M0 instructions, from arm's document. http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/BABFFEJF.html Table 3.1. Cortex-M0 instructions MnemonicOperandsBrief description Flags See ADCS{Rd,} Rn, RmAdd with Carry N,Z,C,V ADC, ADD, RSB, SBC, and SUB ADD{S} {Rd,} Rn, <Rm|#imm> Add N,Z,C,V ADC, ADD, RSB, SBC, and SUB ADR Rd, label PC-relative Address to Register - ADR ANDS{Rd,} Rn, RmBitwise AND N,Z ADC, ADD, RSB, SBC, and SUB ASRS{Rd,} Rm, <Rs|#imm> Arithmetic Shift Right N,Z,C ASR, LSL, LSR, and ROR B{cc} label Branch {conditionally} - B, BL, BX, and BLX BICS{Rd,} Rn, RmBit Clear N,Z AND, ORR, EOR, and BIC BKPT#immBreakpoint - BKPT BL label Branch with Link- B, BL, BX, and BLX BLX Rm Branch indirect with Link - B, BL, BX, and BLX BX Rm Branch indirect - B, BL, BX, and BLX CMN Rn, Rm Compare NegativeN,Z,C,V CMP and CMN CMP Rn, <Rm|#imm> Compare N,Z,C,V CMP and CMN CPSID i Change Processor State, Disable Interrupts - CPS CPSIE i Change Processor State, Enable Interrupts - CPS DMB - Data Memory Barrier - DMB DSB - Data Synchronization Barrier- DSB EORS{Rd,} Rn, RmExclusive ORN,Z AND, ORR, EOR, and BIC ISB - Instruction Synchronization Barrier - ISB LDM Rn{!}, reglist Load Multiple registers, increment after- LDM and STM LDR Rt, label Load Register from PC-relative address - Memory access instructions LDR Rt, [Rn, <Rm|#imm>] Load Register with word - Memory access instructions LDRBRt, [Rn, <Rm|#imm>] Load Register with byte - Memory access instructions LDRHRt, [Rn, <Rm|#imm>] Load Register with halfword - Memory access instructions LDRSB Rt, [Rn, <Rm|#imm>] Load Register with signed byte - Memory access instructions LDRSH Rt, [Rn, <Rm|#imm>] Load Register with signed halfword - Memory access instructions LSLS{Rd,} Rn, <Rs|#imm> Logical Shift Left N,Z,C ASR, LSL, LSR, and ROR LSRS{Rd,} Rn, <Rs|#imm> Logical Shift Right N,Z,C ASR, LSL, LSR, and ROR MOV{S} Rd, Rm MoveN,Z MOV and MVN MRS Rd, spec_regMove to general register from special register - MRS MSR spec_reg, RmMove to special register from general register N,Z,C,V MSR MULSRd, Rn, Rm Multiply, 32-bit result N,Z MULS MVNSRd, Rm Bitwise NOT N,Z MOV and MVN NOP - No Operation- NOP ORRS{Rd,} Rn, RmLogical OR N,Z AND, ORR, EOR, and BIC POP reglist Pop registers from stack- PUSH and POP PUSHreglist Push registers onto stack - PUSH and POP REV Rd, Rm Byte-Reverse word - REV, REV16, and REVSH REV16 Rd, Rm Byte-Reverse packed halfwords - REV, REV16, and REVSH REVSH Rd, Rm Byte-Reverse signed halfword- REV, REV16, and REVSH RORS{Rd,} Rn, RsRotate RightN,Z,C ASR, LSL, LSR, and ROR RSBS{Rd,} Rn, #0Reverse SubtractN,Z,C,V ADC, ADD, RSB, SBC, and SUB SBCS{Rd,} Rn, RmSubtract with Carry N,Z,C,V ADC, ADD, RSB, SBC, and SUB SEV - Send Event - SEV STM Rn!, reglistStore Multiple registers, increment after - LDM and STM STR Rt, [Rn, <Rm|#imm>] Store Register as word - Memory access instructions STRBRt, [Rn, <Rm|#imm>] Store Register as byte - Memory access instructions STRHRt, [Rn, <Rm|#imm>] Store Register as halfword - Memory access instructions SUB{S} {Rd,} Rn, <Rm|#imm> SubtractN,Z,C,V ADC, ADD, RSB, SBC, and SUB SVC #immSupervisor Call - SVC SXTBRd, Rm Sign extend byte- SXT and UXT SXTHRd, Rm Sign extend halfword- SXT and UXT TST Rn, Rm Logical AND based test N,Z TST UXTBRd, Rm Zero extend a byte - SXT and UXT UXTHRd, Rm Zero extend a halfword - SXT and UXT WFE - Wait For Event - WFE WFI - Wait For Interrupt - WFI Regards, duhuanpeng ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
[ft-devel] [bug] --> [arm] Fix thumb2 inline assembly under LLVM.
Dear Chongyu Zhu, What is your compiler's option(cflags)? What CPU and instruction set have you tested it? cortex-m0 does not support this instruction, cortex-m0 runs thumb2 too. but it is a subset of thumb2. http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=41632b58eff46d351fffa529a5f860eb63155818 > [arm] Fix thumb2 inline assembly under LLVM. still broken on cortex-m0, what is your compiler flags? Keil RVDS armcc ARMCT gcc [?] --cpu=cortex-m3 [broken] --cpu=cortex-m0 -mcpu=cortex-m0 [OK] --cpu=cortex-r4 > When using `ADD' with an immediate operand, the instruction is > actually `ADD Rd, Rn, #', that is, the maximum of the > immediate operand cannot exceed 4095. It will fail to compile with > LLVM. > > However, in GCC, due to some legacy compatibility considerations, > `ADD.W' will be automatically emitted when the immediate operand is > larger than 4095. > > * builds/unix/ftconfig.in, include/freetype/config/ftconfig.h > (FT_MulFix_arm) [__GNUC__]: Support clang compiler. > > * src/truetype/ttinterp.c (TT_MulFix14_arm) [__GNUC__]: Ditto. > __asm__ __volatile__ ( >"smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */ >"mov%0, %2, asr #31\n\t" /* %0 = (hi >> 31) */ > +#ifdef __clang__ > + "add.w %0, %0, #0x8000\n\t" /* %0 += 0x8000 */ > +#else >"add%0, %0, #0x8000\n\t" /* %0 += 0x8000 */ > +#endif >"adds %1, %1, %0\n\t" /* %1 += %0 */ >"adc%2, %2, #0\n\t" /* %2 += carry */ >"mov%0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */ This will produce an error. could you take a look at this: >>> http://lists.nongnu.org/archive/html/freetype-devel/2018-03/msg00062.html anyway, this is easy, use a register[ip] to help: ldr ip, =0x8000 ; compiler will help translate this too real arm instructions adds r0, r0, ip The problem is cortex-m0 don't have a 32bit * 32bit instruction. >"smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */ could you help to take a look at, is my guess right? http://lists.nongnu.org/archive/html/freetype-devel/2018-03/msg00065.html Regards, duhuanpeng ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
[ft-devel] [PATCH] ftmodule.h: add config menu for Keil IDE
From: DU HUANPENGSigned-off-by: DU HUANPENG --- include/freetype/config/ftmodule.h | 76 ++ 1 file changed, 76 insertions(+) diff --git a/include/freetype/config/ftmodule.h b/include/freetype/config/ftmodule.h index 76d271a..3cb1579 100644 --- a/include/freetype/config/ftmodule.h +++ b/include/freetype/config/ftmodule.h @@ -10,23 +10,99 @@ * */ +/**/ +// <<< Use Configuration Wizard in Context Menu >>> // +/**/ + +// FT_Module_Class info +// FT_Driver_ClassRecinfo +// FT_Driver_ClassRecinfo +// FT_Driver_ClassRecinfo +// FT_Driver_ClassRecinfo +// FT_Driver_ClassRecinfo +// FT_Driver_ClassRecinfo +// FT_Driver_ClassRecinfo +// FT_Driver_ClassRecinfo +// FT_Module_Class info +// FT_Module_Class info +// FT_Module_Class info +// FT_Renderer_Class info +// FT_Module_Class info +// FT_Renderer_Class info +// FT_Renderer_Class info +// FT_Renderer_Class info +// FT_Driver_ClassRecinfo + +#if 1 FT_USE_MODULE( FT_Module_Class, autofit_module_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Module_Class, psaux_module_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Module_Class, psnames_module_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Module_Class, pshinter_module_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Module_Class, sfnt_module_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class ) +#endif /* EOF */ -- 2.7.4 ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
[ft-devel] [PATCH] ftmodule.h: add config menu for Keil IDE
From: DU HUANPENGSigned-off-by: DU HUANPENG --- include/freetype/config/ftmodule.h | 76 ++ 1 file changed, 76 insertions(+) diff --git a/include/freetype/config/ftmodule.h b/include/freetype/config/ftmodule.h index 76d271a..3cb1579 100644 --- a/include/freetype/config/ftmodule.h +++ b/include/freetype/config/ftmodule.h @@ -10,23 +10,99 @@ * */ +/**/ +// <<< Use Configuration Wizard in Context Menu >>> // +/**/ + +// FT_Module_Class info +// FT_Driver_ClassRecinfo +// FT_Driver_ClassRecinfo +// FT_Driver_ClassRecinfo +// FT_Driver_ClassRecinfo +// FT_Driver_ClassRecinfo +// FT_Driver_ClassRecinfo +// FT_Driver_ClassRecinfo +// FT_Driver_ClassRecinfo +// FT_Module_Class info +// FT_Module_Class info +// FT_Module_Class info +// FT_Renderer_Class info +// FT_Module_Class info +// FT_Renderer_Class info +// FT_Renderer_Class info +// FT_Renderer_Class info +// FT_Driver_ClassRecinfo + +#if 1 FT_USE_MODULE( FT_Module_Class, autofit_module_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Module_Class, psaux_module_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Module_Class, psnames_module_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Module_Class, pshinter_module_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Module_Class, sfnt_module_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class ) +#endif + +#if 1 FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class ) +#endif /* EOF */ -- 2.7.4 ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] FT_New_Memory_Face: get error code 2 on arm
Hi, Please check my previously email carefully. And you addw produce a grammar error. add.w is not supported. "aplusb.s" 41L, 1076C written du@router:~/asm$ armcc aplusb.s "aplusb.s", line 13: Error: A1617E: Specified width is not supported by the current instruction set 13 0006 add.w r0, r0, #0x8000 "aplusb.s", line 14: Error: A1854E: Unknown opcode 'addw', maybe wrong target CPU? 14 000a addw r0, r0, #0x8000 "aplusb.s", line 35: Error: A1312E: Assertion failed 35 0004 ASSERT {INTER} = {TRUE} 3 Errors, 0 Warnings ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] FT_New_Memory_Face: get error code 2 on arm
-Original Message- From: Alexei Podtelezhnikov [mailto:apodt...@gmail.com] Sent: Thursday, March 15, 2018 4:00 AM To: duhuanpeng; freetype-devel Subject: Re: [ft-devel] FT_New_Memory_Face: get error code 2 on arm On Wed, Mar 14, 2018 at 9:22 AM, duhuanpeng <548708...@qq.com> wrote: > My cortex-m0 board is using a armcc(rvct) with keil 5.22a I can send > me my whole project if you wish. Please try "addw" instead of "add" in the assembler code. addw a, a, #0x8000 /* a += 0x8000 */ Then we can think how to merge ARMCC and GNUC assembly versions. 0x8000 takes at least 8+(log32/log(n)) bits. n is 5 , So 0x8000 is a 13 bit number. The thumb code is 16 bit machine code. So, "add a, a, #0x8000" will be translated in to at least two machine code. "aplusb.s" 40L, 1054C written du@router:~/asm$ armcc aplusb.s "aplusb.s", line 13: Error: A1617E: Specified width is not supported by the current instruction set 13 0006 add.w r0, r0, #0x8000 "aplusb.s", line 34: Error: A1312E: Assertion failed 34 0004 ASSERT {INTER} = {TRUE} 2 Errors, 0 Warnings Hi, here is my experiment: C program: aplusb.c int plusa(int a) { a += 0x8000; return a; } ; generated by Component: ARM Compiler 5.06 update 3 (build 30 0) Tool: armcc [4d35f0] ; commandline armcc [-S --cpu=Cortex-M0 -O3 aplusb.c] THUMB REQUIRE8 PRESERVE8 AREA ||.text||, CODE, READONLY, ALIGN=1 plusa PROC MOVS r1,#1 LSLS r1,r1,#15 ADDS r0,r0,r1 BX lr ENDP AREA ||.arm_vfe_header||, DATA, READONLY, NOALLOC, ALIGN=2 ; generated by Component: ARM Compiler 5.06 update 3 (build 30 0) Tool: armcc [4d35f0] ; commandline armcc [-S --cpu=Cortex-R4 -O3 aplusb.c] ARM REQUIRE8 PRESERVE8 AREA ||.text||, CODE, READONLY, ALIGN=2 plusa PROC ADD r0,r0,#0x8000 BX lr ENDP AREA ||.arm_vfe_header||, DATA, READONLY, NOALLOC, ALI GN=2 DCD 0x .cpu cortex-m0 .eabi_attribute 20, 1 .eabi_attribute 21, 1 .eabi_attribute 23, 3 .eabi_attribute 24, 1 .eabi_attribute 25, 1 .eabi_attribute 26, 1 .eabi_attribute 30, 2 .eabi_attribute 34, 0 .eabi_attribute 18, 4 .file "aplusb.c" .text .align 1 .p2align 2,,3 .global plusa .syntax unified .code 16 .thumb_func .fpu softvfp .type plusa, %function plusa: @ args = 0, pretend = 0, frame = 0 @ frame_needed = 0, uses_anonymous_args = 0 @ link register save eliminated. movsr3, #128 lslsr3, r3, #8 mov ip, r3 @ sp needed add r0, r0, ip bx lr .size plusa, .-plusa .ident "GCC: (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 7.2.1 20170904 (release ) [ARM/embedded-7-branch revision 255204]" ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] FT_New_Memory_Face: get error code 2 on arm
Hi, > http://www.keil.com/support/man/docs/armasm/armasm_dom1361289902800.htm >From this piece code: (ftcalc.c +244) return (int32_t)( ( ab + 0x8000L - ( ab < 0 ) ) >> 16 ); this routine seems produce a result of a integer include the bit 16 to bit (16+32) and round up? Greater than one half --> +1 Less than one half --> discard FT_MulFix a b a x b become a 64bit interger. a x b:|B7|B6|B5|B4|B3|B2|B1|B0| |xx|xx|B5|B4|B3|B2|xx|xx| If(|B1|B0| > 0x1/2) |B5|B4|B3|B2| += 1 ->return |B5|B4|B3|B2| Am I understand this right? Regards, duhuanpeng ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] FT_New_Memory_Face: get error code 2 on arm
> But I get an error code (2) on my M0 board. > >FT_New_Memory_Face: 2 >The error codes are given in file `fterrdef.h'; error 2 means `unknown file >format'. Maybe an endianness problem while setting up the external array >holding >the PCF data? I believe no. this font file is tested in my cortex-r4 board. When I put a .fon(winfnt.c) or .pcf.Z(pcf.c+ftlzw.c), I get the same result. The cortex-M0 board is little endian too. (Maybe it is useless to run freetype2 on a cortex-m0 board. :D) If you activate debugging with #define FT_DEBUG_LEVEL_ERROR #define FT_DEBUG_LEVEL_TRACE >in `ftoption.h', then setting the environment variable `FT2_DEBUG' to `any:7' >you will perhaps get more detailed information on the problem FreeType has >encountered. >[In case your environment doesn't have environment variables you have to >adjust `ftdebug.c' accordingly.] FT_BASE_DEF( void ) ft_debug_init( void ) { const char* ft2_debug = ft_getenv( "FT2_DEBUG" ); + const char any7[] = "any:7"; + ft2_debug = any7; And change these lines: -vfprintf( stderr, fmt, ap ); +printf(fmt, ap); And add -DFT_DEBUG_LEVEL_ERROR -DFT_DEBUG_LEVEL_TRACE //#ifdef FT_DEBUG_LEVEL_ERROR #if 1 /* documentation is in ftdebug.h */ FT_BASE_DEF( void ) Hmm no output. Of course there could also be a bug in FreeType. However, I can't debug this... > By the way, the assembly code is broken with thumb2: > > static __inline FT_Int32 > > FT_MulFix_arm( FT_Int32 a, > > FT_Int32 b ) > > { > >FT_Int32 t, t2; > > > > > >__asm > >{ > > smull t2, t, b, a /* (lo=t2,hi=t) = a*b */ > > mov a, t, asr #31 /* a = (hi >> 31) */ > > add a, a, #0x8000 /* a += 0x8000 */ > > adds t2, t2, a /* t2 += a */ > > adc t, t, #0 /* t += carry */ > > mov a, t2, lsr #16 /* a = t2 >> 16 */ > > orr a, a, t, lsl #16 /* a |= t << 16 */ > >} > >return a; > > } > Can you fix it? I have zero knowledge w.r.t. assembler code. I will try, can you tell me what it's intention... I can write a small program to test this separate. This is the code I found in freetype and make a little change: int32_t FT_MulFix_C( int32_t a_, int32_t b_ ) { int64_t ab = (int64_t)a_ * (int64_t)b_; /* this requires arithmetic right shift of signed numbers */ return (int32_t)( ( ab + 0x8000L - ( ab < 0 ) ) >> 16 ); } Some staff: http://www.keil.com/forum/59448/64bit-arithmetic-on-cortex-m0/ int64_t is supported, but generate long code like this: FT_MulFix_C PROC PUSH {r4,lr} BL __ARM_common_ll_mulss CMP r1,#0 BGE |L0.14| MOVS r2,#1 B|L0.16| |L0.14| MOVS r2,#0 |L0.16| ASRS r3,r2,#31 SUBS r0,r0,r2 SBCS r1,r1,r3 MOVS r3,#1 LSLS r3,r3,#15 MOVS r2,#0 ADDS r0,r0,r3 ADCS r1,r1,r2 LSLS r1,r1,#16 LSRS r0,r0,#16 ORRS r0,r0,r1 POP {r4,pc} ENDP AREA ||.arm_vfe_header||, DATA, READONLY, NOALLOC, ALIGN=2 DCD 0x AREA ||i.__ARM_common_ll_mulss||, COMGROUP=__ARM_common_ll_mulss, CODE, READONLY, ALIGN=1 __ARM_common_ll_mulss PROC PUSH {r3-r7,lr} ASRS r4,r0,#16 UXTH r3,r1 MOV r6,r4 UXTH r2,r0 MULS r6,r3,r6 ASRS r5,r1,#16 MOV r0,r2 ASRS r7,r6,#16 MULS r0,r3,r0 LSLS r6,r6,#16 ADDS r0,r0,r6 MOVS r1,#0 ADCS r1,r1,r7 MOV r6,r2 MULS r6,r5,r6 ASRS r7,r6,#16 LSLS r6,r6,#16 ADDS r0,r0,r6 ADCS r1,r1,r7 MOV r6,r4 MULS r6,r5,r6 ADDS r1,r1,r6 POP {r3-r7,pc} ENDP duhaunpeng ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
[ft-devel] FT_New_Memory_Face: get error code 2 on arm
Hi, My test program https://paste.ubuntu.com/p/vvwW5bfmrF/ runs normal on my pc and my cortex-r4 board. But I get an error code (2) on my M0 board. The compile log is: https://paste.ubuntu.com/p/kKQs7FhVVV/ output: >buffer: >FT_Init_FreeType: 0 >FT_New_Memory_Face: 2 > num_glyphs: 0 >face sizeds: 0 >FT_Load_Char: error=23 >M0: [1] >M1: [1] >Hello World. By the way, the assembly code is broken with thumb2: > static __inline FT_Int32 > FT_MulFix_arm( FT_Int32 a, > FT_Int32 b ) > { >FT_Int32 t, t2; > > >__asm >{ > smull t2, t, b, a /* (lo=t2,hi=t) = a*b */ > mov a, t, asr #31 /* a = (hi >> 31) */ > add a, a, #0x8000 /* a += 0x8000 */ > adds t2, t2, a /* t2 += a */ > adc t, t, #0 /* t += carry */ > mov a, t2, lsr #16 /* a = t2 >> 16 */ > orr a, a, t, lsl #16 /* a |= t << 16 */ >} > return a; > } For workaround I disabled /* #define FT_CONFIG_OPTION_NO_ASSEMBLER */ Regards, duhuanpeng ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
[ft-devel] ftmodule.h: Keil IDE configurable header
/**/ /* STM32F10x_DBG.ini: STM32 Debugger Initialization File */ /**/ // <<< Use Configuration Wizard in Context Menu >>> // /**/ /* This file is part of the uVision/ARM development tools.*/ /* Copyright (c) 2005-2010 Keil Software. All rights reserved.*/ /* This software may only be used under the terms of a valid, current,*/ /* end user licence from KEIL for a compatible version of KEIL software */ /* development tools. Nothing else gives you the right to use this software. */ /**/ /* * This file registers the FreeType modules compiled into the library. * * If you use GNU make, this file IS NOT USED! Instead, it is created in * the objects directory (normally `/objs/') based on information * from `/modules.cfg'. * * Please read `docs/INSTALL.ANY' and `docs/CUSTOMIZE' how to compile * FreeType without GNU make. * */ // AUTOFIT_MODULE_CLASS info // TT_DRIVER_CLASSinfo // T1_DRIVER_CLASSinfo // CFF_DRIVER_CLASS info // T1CID_DRIVER_CLASS info // PFR_DRIVER_CLASS info // T42_DRIVER_CLASS info // WINFNT_DRIVER_CLASSinfo // PCF_DRIVER_CLASS info // PSAUX_MODULE_CLASS info // PSNAMES_MODULE_CLASS info // PSHINTER_MODULE_CLASS info // FT_RASTER1_RENDERER_CLASS info // SFNT_MODULE_CLASS info // FT_SMOOTH_RENDERER_CLASS info // FT_SMOOTH_LCD_RENDERER_CLASS info // FT_SMOOTH_LCDV_RENDERER_CLASS info // BDF_DRIVER_CLASS info #define AUTOFIT_MODULE_CLASS 1 #define TT_DRIVER_CLASS 1 #define T1_DRIVER_CLASS 1 #define CFF_DRIVER_CLASS 1 #define T1CID_DRIVER_CLASS1 #define PFR_DRIVER_CLASS 1 #define T42_DRIVER_CLASS 1 #define WINFNT_DRIVER_CLASS 1 #define PCF_DRIVER_CLASS 1 #define PSAUX_MODULE_CLASS1 #define PSNAMES_MODULE_CLASS 1 #define PSHINTER_MODULE_CLASS 1 #define FT_RASTER1_RENDERER_CLASS 1 #define SFNT_MODULE_CLASS 1 #define FT_SMOOTH_RENDERER_CLASS 1 #define FT_SMOOTH_LCD_RENDERER_CLASS 1 #define FT_SMOOTH_LCDV_RENDERER_CLASS 1 #define BDF_DRIVER_CLASS 1 #if AUTOFIT_MODULE_CLASS FT_USE_MODULE( FT_Module_Class, autofit_module_class ) #endif #if TT_DRIVER_CLASS FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class ) #endif #if T1_DRIVER_CLASS FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class ) #endif #if CFF_DRIVER_CLASS FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class ) #endif #if T1CID_DRIVER_CLASS FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class ) #endif #if PFR_DRIVER_CLASS FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class ) #endif #if T42_DRIVER_CLASS FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class ) #endif #if WINFNT_DRIVER_CLASS FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class ) #endif #if PCF_DRIVER_CLASS FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class ) #endif #if PSAUX_MODULE_CLASS FT_USE_MODULE( FT_Module_Class, psaux_module_class ) #endif #if PSNAMES_MODULE_CLASS FT_USE_MODULE( FT_Module_Class, psnames_module_class ) #endif #if PSHINTER_MODULE_CLASS FT_USE_MODULE( FT_Module_Class, pshinter_module_class ) #endif #if FT_RASTER1_RENDERER_CLASS FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class ) #endif #if SFNT_MODULE_CLASS FT_USE_MODULE( FT_Module_Class, sfnt_module_class ) #endif #if FT_SMOOTH_RENDERER_CLASS FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class ) #endif #if FT_SMOOTH_LCD_RENDERER_CLASS FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class ) #endif #if FT_SMOOTH_LCDV_RENDERER_CLASS FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class ) #endif #if BDF_DRIVER_CLASS FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class ) #endif /* EOF */ ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] How to port freetype2 to a system without file system
Hi, I want to paste the source code here, for people in the future. /*/ /* */ /* */ /*FT_New_Memory_Face */ /* */ /* */ /*Call @FT_Open_Face to open a font that has been loaded into*/ /*memory.*/ /* */ /**/ /*library:: A handle to the library resource.*/ /* */ /**/ /*file_base :: A pointer to the beginning of the font data. */ /* */ /*file_size :: The size of the memory chunk used by the font data. */ /* */ /*face_index :: See @FT_Open_Face for a detailed description of this */ /* parameter. */ /* */ /* */ /*aface :: A handle to a new face object. If `face_index' is */ /* greater than or equal to zero, it must be non-NULL. */ /* */ /* */ /*FreeType error code. 0~means success. */ /* */ /* */ /*You must not deallocate the memory before calling @FT_Done_Face. */ /* */ FT_EXPORT( FT_Error ) FT_New_Memory_Face( FT_Library library, const FT_Byte* file_base, FT_Long file_size, FT_Long face_index, FT_Face*aface ); -Original Message- From: Freetype-devel [mailto:freetype-devel-bounces+548708880=qq@nongnu.org] On Behalf Of duhuanpeng Sent: Monday, March 12, 2018 11:25 PM To: freetype-devel@nongnu.org Subject: [ft-devel] How to port freetype2 to a system without file system Hello, I have ported freetype2 to our system. Our system don't supports file system, so I write some functions to emulate file operations. > fopen, fread, etc. But now I maintain a "FILE" array, it eats a lot memory. Is there any better way to port freetype2? Our fonts are store in flash, it appears like a normal array. like: extern char font1[]; extern char font2[]; (actually, I store multi font files in a single romfs image block.) Regards, duhuanpeng ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] How to port freetype2 to a system without file system (Re: Freetype-devel Digest, Vol 158, Issue 16)
> Hello, > I have ported freetype2 to our system. > Our system don't supports file system, so I write some functions to > emulate file operations. > fopen, fread, etc. > But now I maintain a "FILE" array, it > eats a lot memory. > Is there any better way to port > freetype2? > Our fonts are store in flash, it > appears like a normal array. > like: > extern char font1[]; > extern char font2[]; > (actually, I store multi font files in a single romfs image block.) >Can you not use FT_New_Memory_Face() ? That treats a block of memory > as a font file. You should be able to pass font1, font2 directly as > the 2nd argument to FT_New_Memory_Face() . Hi, I will try this. Should I leave the ftsystem.c unchanged? Regards, duhuanpeng ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
[ft-devel] How to port freetype2 to a system without file system
Hello, I have ported freetype2 to our system. Our system don't supports file system, so I write some functions to emulate file operations. > fopen, fread, etc. But now I maintain a "FILE" array, it eats a lot memory. Is there any better way to port freetype2? Our fonts are store in flash, it appears like a normal array. like: extern char font1[]; extern char font2[]; (actually, I store multi font files in a single romfs image block.) Regards, duhuanpeng ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
[ft-devel] CUSTOM: How to remove ftfntfmt.c and ftlcdfil.c
Hi, I am custom my freetype. I followed INSTALL.ANY. Here is my ftmodule.h, only one line: FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class ) And remove this macro in ftoption.h -#define FT_CONFIG_OPTION_USE_ZLIB And I encounter some errors: .\Obj\STM3210E-LK.axf: Error: L6218E: Undefined symbol FT_Get_Font_Format (referred from ftbase.o). .\Obj\STM3210E-LK.axf: Error: L6218E: Undefined symbol ft_lcd_padding (referred from ftbase.o). .\Obj\STM3210E-LK.axf: Error: L6218E: Undefined symbol FT_Bitmap_Copy (referred from ftglyph.o). .\Obj\STM3210E-LK.axf: Error: L6218E: Undefined symbol FT_Bitmap_Done (referred from ftglyph.o). .\Obj\STM3210E-LK.axf: Error: L6218E: Undefined symbol FT_Bitmap_Init (referred from ftglyph.o). And I try to add ftfntfmt.c and ftlcdfil.c, it gets ok. (enough for me, just waste some bytes) Compile log... https://paste.ubuntu.com/p/wPhBGqYbbp/ - - - - I have try to remove ftfntfmt.c and ftlcdfil.c. and remove some macro in ftoption.h -#define FT_CONFIG_OPTION_MAC_FONTS But I still get compile errors like above. How to remove this two files or it is needed? I just need pcf and pcf.Z font be supported. Regards, duhuanpeng ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] porting: Where should i start debugging
Dear Werner, >If in doubt I suggest that you primarily have a look at the FreeType demo >programs, > which use a large portion of the provided API. By the way, my Linux box is headless, so I run a vnc4server. But I get this result: du@router:~/ft2demos-2.9/bin$ ./ftview 16 Gb16st.pcf.Z could not allocate display surface error = 0x, no error du@router:~/ft2demos-2.9/bin$ When I become root to run this program, I still get the same result. Can I run "ftview" in text mode? I am going to run my code on my target board tomorrow. Thank you again. Regards, duhuanpeng ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] porting: Where should i start debugging
Dear all, I can show the fonts on my pc now, thanks to Werner very much. I read this page again: https://www.freetype.org/freetype2/docs/glyphs/glyphs-7.html#section-2 And my code is here: void dump_ft_bitmap( FT_Bitmap* bitmap) { unsigned int i, j; unsigned q; unsigned rows = bitmap->rows; unsigned width = bitmap->width; int pitch = bitmap->pitch; unsigned char ch; q = 0; for(i=0; i<rows; i++) { for (j=0; j<width; j+=pitch) { ch = bitmap->buffer[q]; dump_byte(ch); q++; } printf("\r\n"); } } slot->bitmap->pixel_mode:(1) slot->bitmap->pitch:(4) OO OOO OO OOOO OO OOOO OO OOOO OO OOOOO OO OO OO OOOO OO OO OOOO OOO OO OOOO O OOO OO OOOO OO OO OO slot->bitmap->pixel_mode:(1) slot->bitmap->pitch:(4) O O OO OO O OO OO OO OO OO OO OO O OO OO OO O O O O O OOO O O OOO O OO OO OO OO OO OO OOOOO O O slot->bitmap->pixel_mode:(1) slot->bitmap->pitch:(4) Now I am going to run this code on my target board. Thank you all again. Regards, duhuanpeng -Original Message- From: duhuanpeng [mailto:548708...@qq.com] Sent: Saturday, March 03, 2018 8:31 PM To: 'Werner LEMBERG' Cc: 'freetype-devel@nongnu.org'; 'guqia...@qq.com'; 548708...@qq.com Subject: RE: [ft-devel] porting: Where should i start debugging Dear Werner, First, thank you very much for your replying. >* Your `dump_bitmap' version only produces crap for bitmap fonts (the > original function in the sample code doesn't work either, BTW – I've > just added a comment to `example1.c'). Reason is that you don't > check the buffer format of `slot->bitmap->pixel_mode', which is > FT_PIXEL_MODE_MONO in this case (meaning 8 pixels per byte). Ah, I have change my code to below, take a look at https://paste.ubuntu.com/p/9MxcP5czZt/ line 77, 97 The output still *not* correct: *--*^M | O |^M | O OO O |^M | O OOO O|^M | O OOO O |^M |OOO O O |^M | OO OO|^M | OO OOO|^M | OOO OO O|^M ||^M |O OO|^M | OO OO|^M ||^M |O O OOO|^M | O|^M |OO O OO OO|^M ||^M *--*^M See more (https://paste.ubuntu.com/p/NyXKB3CHd9/) What is the FT_PIXEL_MODE_MONO bitmap format? The output above is Byte[0] Byte[1] (bit order 7-0) Byte[3] byte[4] Byte[5] byte[6] ...(more)... Byte[30] Byte[31] >* `FT_Load_Char' doesn't work for `gbst16.pcf' as expected. Reason is > that this font is not encoded in Unicode (it is rather using GB2312 > encoding), thus FreeType can't set up a cmap. In this case, > `FT_Load_Char' behaves like `FT_Load_Glyph', this is, it handles the > input character codes as glyph indices. > You have to manually convert input character codes to glyph indices > (for example, using `iconv'), then using `FT_Load_Glyph'. My input character is below, it is a interger. I guess at least, I guess it will Show some character? for(ch=97; ch<65535; ch++) { ... } By the way, my git repo is here, I am trying to make freetype compiled by keil: https://gitee.com/m32/freetype2 Keil is quite popular IDE for MCU, hope you can give me some suggestion. Regards, duhuanpeng ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] porting: Where should i start debugging
Dear Werner, First, thank you very much for your replying. >* Your `dump_bitmap' version only produces crap for bitmap fonts (the > original function in the sample code doesn't work either, BTW – I've > just added a comment to `example1.c'). Reason is that you don't > check the buffer format of `slot->bitmap->pixel_mode', which is > FT_PIXEL_MODE_MONO in this case (meaning 8 pixels per byte). Ah, I have change my code to below, take a look at https://paste.ubuntu.com/p/9MxcP5czZt/ line 77, 97 The output still *not* correct: *--*^M | O |^M | O OO O |^M | O OOO O|^M | O OOO O |^M |OOO O O |^M | OO OO|^M | OO OOO|^M | OOO OO O|^M ||^M |O OO|^M | OO OO|^M ||^M |O O OOO|^M | O|^M |OO O OO OO|^M ||^M *--*^M See more (https://paste.ubuntu.com/p/NyXKB3CHd9/) What is the FT_PIXEL_MODE_MONO bitmap format? The output above is Byte[0] Byte[1] (bit order 7-0) Byte[3] byte[4] Byte[5] byte[6] ...(more)... Byte[30] Byte[31] >* `FT_Load_Char' doesn't work for `gbst16.pcf' as expected. Reason is > that this font is not encoded in Unicode (it is rather using GB2312 > encoding), thus FreeType can't set up a cmap. In this case, > `FT_Load_Char' behaves like `FT_Load_Glyph', this is, it handles the > input character codes as glyph indices. > You have to manually convert input character codes to glyph indices > (for example, using `iconv'), then using `FT_Load_Glyph'. My input character is below, it is a interger. I guess at least, I guess it will Show some character? for(ch=97; ch<65535; ch++) { ... } By the way, my git repo is here, I am trying to make freetype compiled by keil: https://gitee.com/m32/freetype2 Keil is quite popular IDE for MCU, hope you can give me some suggestion. Regards, duhuanpeng ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
[ft-devel] porting: Where should i start debugging
Dear all, I am porting freetype to a "bare or rtos" system. This system supports fat file system and has "malloc" family routines. Here is build log for this target: https://paste.ubuntu.com/p/rxQsMTmtZV/ Here is build log on my pc, Ubuntu GNU/Linux: https://paste.ubuntu.com/p/DjNkvGHPg3/ Here is my test program: https://paste.ubuntu.com/p/Wm5hZtYt7p/ My Makefile on PC: dump1: dump1.c gcc $< -D__PC__ -L/home/du/source/freetype2/objs -L/usr/lib/x86_64-linux-gnu -lfreetype -lz -I/home/du/source/freetype2/include -I/usr/include/freetype2 -lm -o $@ But I can't get the correct font. This is the output when I use *Gb16st.pcf* , Google driver: goo.gl/ZWqa4d face sizeds: 1 ** || || || || |@ @ | |O@.O@@ O@.O@@ | |o. . | |o. O. | |. | |@. | |O @. | || |@. | |. O | |@@.O@@ @@.O@@ | || ** || || || || |@ @ | |O@.O@@ O@.O@@ | |o. . | |o. O. | |. | |@. | |O @. | || |@. | |. O | |@@.O@@ @@.O@@ | || ** || || || || |@ @ | |O@.O@@ O@.O@@ | ... (more and more) ... FT_Load_Char: error=6 FT_Load_Char: error=6 FT_Load_Char: error=6 FT_Load_Char: error=6 FT_Load_Char: error=6 FT_Load_Char: error=6 Where should I start debugging? Regards, Du Huanpeng ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel