Hello On 28.06.09, you wrote:
> Note, however, that this API doesn't provide you with information about > font weight, slantedness, or size. If you need that information to open > a font, then you may be stuck. I do some profiling on netsurf, the open font seem cost not much speed when the font was open before.freetype use a cache.maybe it can happen when use lots fonts, that this cache get too small. but there is a command in freetype to set the cache size. But what cost much speed and also depend on memory system get fragment slowdown, is that netsurf on libxml and somewhere else do very often malloc and free calls. i guess near 15% of overall time netsurf stay in malloc and free calls.the good news is that netsurf use very few stack.I notice only 30 kb stack usage.but is there a way to replace some frequently malloc/ free with malloc on stack ? On amiga 68k OS there are memtrackers for developing (that add bounds around each memblock, normaly it slow down a program by about 50%. But when run netsurf it slowdown a program by about Factor 10.and i use a AMD64 3000+ with a memtransfer speed of 800 megabytes with the amiga emulator. It is near impossible to show a page in usefull time when memtracker is on. but recommend to develop programs is use memtracker that do boundcheck on every free command and fill the freed blocks to see soon code that access a freed block. > >> How do we find out when NetSurf has finished with it (for the page)? > > It's guaranteed to be finished with it once the redraw has completed. > It's your choice whether to keep it around for longer. > >> Some way of keeping track of usage in the platform code and being able >> to flush any that have not been used for a while would be useful here >> I think. > > Can you not do this with the proposed API? An LRU cache of font > descriptors shouldn't be hard to implement on top of it. You'll want to > base usage on calls to the text plotter with the given font handle as > it's possible that the core redraw stuff will optimise out calling > find_font in cases where it already knows the font handle for some text. > >> Regarding generic families, the easiest thing would be for NetSurf to >> send the user's selected font for the desired family (from >> option_font_sans etc) in the font_names array. > > Yes, I'm inclined to agree. The array is sorted as per the original > font-family rule that generated it. For example: > > font-family: "Helvetica", "Arial", sans-serif; > > would produce an array: > > Helvetica > Arial > <option_font_sans> > > find_font need only scan as much of the array as needed to find a font > it can use. > > > J. > Regards
