freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to calculate the size of FT_RENDER_POOL for 240x320 LCD


From: ricky rocky
Subject: Re: How to calculate the size of FT_RENDER_POOL for 240x320 LCD
Date: Wed, 21 Dec 2022 17:50:53 +0900

Add freetype-devel@nongnu.org

On Wed, Dec 21, 2022, 5:48 PM ricky rocky <rickyrocky.ble@gmail.com> wrote:
Thanks for your reply soon.

> do you want to allocate it elsewhere, not on stack?
It is OK on stack, I just want to reduce its size. Because RAM memory capacity is 10kB left.

> you cannot spare 16kB for rendering
Do you mean, cannot reduce 16kB size?
I saw an info that, can reduce 16kB -> 4kB, but I don't know if that will cause any bug when rendering.

https://opensource.apple.com/source/X11proto/X11proto-15/freetype/freetype-2.3.5/docs/raster.txt.auto.html

> What is the text pixel size that you need?
I'm not an expert in font pixel, could you tell me how to calculate it?
or Is it possible to know based on the information below?
=========
I am using roboto_bold, and the height-width of largest character is 80-80 like below

FT_Size face_size;
struct FTC_ScalerRec_ scaler;
scaler.face_id = (FTC_FaceID)dsc->face_id;
scaler.width = 80;
scaler.height = 80;
scaler.pixel = 1;
error = FTC_Manager_LookupSize(cache_manager, &scaler, &face_size);
=========

> For example, for 20 pixels per EM, ...
what is EM?  :(


On Wed, Dec 21, 2022, 12:13 PM Alexei Podtelezhnikov <apodtele@gmail.com> wrote:
On Tue, Dec 20, 2022 at 9:11 PM ricky rocky <rickyrocky.ble@gmail.com> wrote:
> #define FT_RENDER_POOL_SIZE  16384L
>
> This definition is used in smooth/ftgrays.c/gray_convert_glyph() as a local buffer.
> For my small RAM chip, it is the large size.

You cannot spare 16kB for rendering. Alrighty. Or, do you want to
allocate it elsewhere, not on stack?

> For 240x320 LCD, Could I reduce this size? and how much is good?

What is the text pixel size that you need? Very roughly, the number of
nontrivial pixels is 8x the pixel size, if your font is not too fancy.
Each gray pixel is 16 bytes on 32 bit architectures, more on 64 bits.

For example, for 20 pixels per EM, you can probably get away with 2kB.
You can use even less, but you will pay with performance.

I would like to suggest doubling to pool because 32kB is reasonable these days.

Alexei

reply via email to

[Prev in Thread] Current Thread [Next in Thread]