Hello, We've rewritten our programm without using any "server side" text-size calculation... I just use the client browser, (a table without any fixed width can adapt his size automatically) Now, my pages loads as fast as MS.NET But, the problem isn't here System.Drawing font measure function is incredibly slower and CPU intensive than MS.NET... I can do benchmarks if you want... (i've gentoo linux and WS2003 on the same machine)
Le Jeudi 12 Mai 2005 19:50, Rafael Teixeira a �crit�: > Also, you can create that font only once (cache it by the Name and > Size) and reuse in many pages, just beware o memory consumption, if > you doesn't limit the choices for fonts and sizes. > > I also reiterate what Ben said, doesn't calculate things on the > server, because things will go diferently on the client. To add > another issue (besides user-chosen-css, installed fonts) the > resolution may be different, what makes the same font render quite > differently. > > HIH, > > On 5/12/05, Ben Maurer <[EMAIL PROTECTED]> wrote: > > On Thu, 2005-05-12 at 11:04 +0200, Hubert FONGARNAND wrote: > > > I apologize, i've found my problem... > > > This slowdown is due to System.Drawing > > > > > > Let me explain... > > > Mono renders a page with more than 100 menu, for each menu, the largest > > > item size is calculated by this function : > > > > > > SizeF size; > > > float emSize = > > > Convert.ToSingle(fontInfo.Size.Unit.Value); emSize = (emSize==0 ?8 > > > :emSize); > > > Font stringFont = new Font(fontInfo.Name, emSize); > > > Graphics g=new Bitmap(1,1); > > > size = g.MeasureString(text, stringFont); > > > g.Dispose(); > > > return size; > > > > > > After doing some tests, i've seen that the slowest line is : > > > Font stringFont = new Font(fontInfo.Name, emSize); > > > So the creation of this Font object (the font is Arial) is extremely > > > slow comparing to MS.NET... > > > If I remove this line, the page loads as fast as MS.NET (a little bit > > > faster...) > > > > > > Is there a way to optimize System.Drawing for this problem; > > > or is there a better way to measure a text string length (with variable > > > font size) without using this very slow function... > > > > I'm not sure how much we can speed that up. I can take a look at how > > Cairo does the stuff. > > > > However, if I understand what you are doing correctly, you are trying to > > measure a string on the server and see how large it will be on the > > client. I am not sure how well that will work. On the client side, > > people might have different fonts installed, or might even use a user > > css sheet. Nonetheless, we should still try to be faster here. > > > > -- Ben > > > > _______________________________________________ > > Mono-devel-list mailing list > > [email protected] > > http://lists.ximian.com/mailman/listinfo/mono-devel-list _______________________________________________ Ce message et les �ventuels documents joints peuvent contenir des informations confidentielles. Au cas o� il ne vous serait pas destin�, nous vous remercions de bien vouloir le supprimer et en aviser imm�diatement l'exp�diteur. Toute utilisation de ce message non conforme � sa destination, toute diffusion ou publication, totale ou partielle et quel qu'en soit le moyen est formellement interdite. Les communications sur internet n'�tant pas s�curis�es, l'int�grit� de ce message n'est pas assur�e et la soci�t� �mettrice ne peut �tre tenue pour responsable de son contenu. _______________________________________________ Mono-devel-list mailing list [email protected] http://lists.ximian.com/mailman/listinfo/mono-devel-list
