Re: [webkit-dev] Font Name
I can add to this that If someone wants to work on text rendering and doesn't want to deal with html or CSS parsing, he can find an index for the font family under: Font->m_fontDescription->m_familyList->m_family->m_Data. I know for example that index for monospace family is 67 or for times new roman is 84 but I still don't know if there is a table some where about all indexes for font families. Soheil Servati Beiragh PhD Candidate, ECE Department, Research Center for Integrated Microsystems, University of Windsor. Room 268 Essex Hall 401 Sunset Avenue Windsor, Ontario Canada, N9B 3P4 Phone: 519-253-3000 Ext 3396 Email: serv...@uwindsor.ca From: Eric Seidel To: Mustafizur Rahaman Cc: Soheil Servati ; WebKit Development Sent: Sunday, May 29, 2011 12:59 PM Subject: Re: [webkit-dev] Font Name There are a couple steps missing, but this hits most of the important points. I think one could turn such into a blog post with diagrams if so desired. -eric On Sat, May 21, 2011 at 5:55 PM, Mustafizur Rahaman wrote: Hi, > >When you are drawing some text, you create a RenderText(RenderObject) which >has all the rendering info & the m_style of RenderText has the style info >required to render the text. > >Let's consider the following style data I have in my html page > >body.rahaman{ >font:30px courier; >} > > Rahaman > >Once the HTMLTreeBuilder parses the token, it creates HTMLStyleElement & >CSSStyleSheet & then asks the CSSParser to parse the StyleSheet. From there it >comes to CSSParser::parseValue()=>CSSParser::parseFont() as the I have only >used font property > >We create a FontValue (which contain all the attribute a font property can >have like style, size, variant, family etc=> in this font_family, you can >actually see the font name you have used ). In CSSParser::parseFont, we >populate the FontValue structure (you can find the font family name in >font->family), calls CSSParser::addProperty() where we create a CSSProperty >with the FontValue/CSSValue being passed & this property is being stored in >CSSParser::m_parsedProperties. > >Then we call CSSParser::createStyleRule where we used the m_parsedProperties >mentioned before to create a CSSMutableStyleDeclaration & set this declaration >for the CSSRule. > >We then create CSSStyleSelector and call CSSStyleSelector::styleForElement for >the root element. Here somehow (I don't have much details what happens in >berween but figured out that we retrieve the same CSSMutableStyleDeclaration >mentioned above) & call CSSStyleSelector::applyProperty(). Here each >StyleSelector has its RenderStyle (m_style), where from we retrieve the >FontDescription & add the properties accordingly. On the other hand, each >RenderObject (the corresponding node in the RenderTree for a node in DOM tree) >has RenderStyle, which gets the value we retrieved above. > >Finally we call GraphicsContext::drawText() passing the Font which we have >retrieved from the RenderStyle we dsicussed above. > >I am not sure if this is what you were looking for, I just shared whatever I >knew of the related area. Please let me know if you need anything else. > >Thanks, >Rahaman > > > >On Fri, May 20, 2011 at 12:22 AM, Soheil Servati Beiragh >wrote: > >Hi >>I want to know after webkit parses the html file where does it save the font >>that is used for text? It definitely won't save a name for the font but there >>should be some kind of index or sth to tell the rendering engine which font >>is being used. >> >> >>Thanks in advance >> >>Soheil Servati Beiragh >>PhD Candidate, ECE Department, >> >>Research Center for Integrated Microsystems, >>University of Windsor. >>Room 268 Essex Hall >>401 Sunset Avenue >>Windsor, Ontario >>Canada, N9B 3P4 >>Phone: 519-253-3000 Ext 3396 >>Email: serv...@uwindsor.ca >>___ >>webkit-dev mailing list >>webkit-dev@lists.webkit.org >>http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev >> >> > >___ >webkit-dev mailing list >webkit-dev@lists.webkit.org >http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev > >___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
Re: [webkit-dev] Font Name
There are a couple steps missing, but this hits most of the important points. I think one could turn such into a blog post with diagrams if so desired. -eric On Sat, May 21, 2011 at 5:55 PM, Mustafizur Rahaman wrote: > Hi, > > When you are drawing some text, you create a RenderText(RenderObject) > which has all the rendering info & the m_style of RenderText has the style > info required to render the text. > > Let's consider the following style data I have in my html page > > body.rahaman{ > font:30px courier; > } > > Rahaman > > Once the HTMLTreeBuilder parses the token, it creates HTMLStyleElement & > CSSStyleSheet & then asks the CSSParser to parse the StyleSheet. From there > it comes to CSSParser::parseValue()=>CSSParser::parseFont() as the I have > only used font property > > We create a FontValue (which contain all the attribute a font property can > have like style, size, variant, family etc=> in this font_family, you can > actually see the font name you have used ). In CSSParser::parseFont, we > populate the FontValue structure (you can find the font family name in > font->family), calls CSSParser::addProperty() where we create a CSSProperty > with the FontValue/CSSValue being passed & this property is being stored in > CSSParser::m_parsedProperties. > > Then we call CSSParser::createStyleRule where we used the > m_parsedProperties mentioned before to create a CSSMutableStyleDeclaration & > set this declaration for the CSSRule. > > We then create CSSStyleSelector and call CSSStyleSelector::styleForElement > for the root element. Here somehow (I don't have much details what happens > in berween but figured out that we retrieve the same > CSSMutableStyleDeclaration mentioned above) & call > CSSStyleSelector::applyProperty(). Here each StyleSelector has its > RenderStyle (m_style), where from we retrieve the FontDescription & add the > properties accordingly. On the other hand, each RenderObject (the > corresponding node in the RenderTree for a node in DOM tree) has > RenderStyle, which gets the value we retrieved above. > > Finally we call GraphicsContext::drawText() passing the Font which we have > retrieved from the RenderStyle we dsicussed above. > > I am not sure if this is what you were looking for, I just shared whatever > I knew of the related area. Please let me know if you need anything else. > > Thanks, > Rahaman > > > On Fri, May 20, 2011 at 12:22 AM, Soheil Servati Beiragh < > sserv...@yahoo.com> wrote: > >> Hi >> I want to know after webkit parses the html file where does it save the >> font that is used for text? It definitely won't save a name for the font but >> there should be some kind of index or sth to tell the rendering engine which >> font is being used. >> >> Thanks in advance >> >> *Soheil Servati Beiragh* >> *PhD Candidate, ECE Department, >> * >> *Research Center for Integrated Microsystems,* >> *University of Windsor.* >> Room 268 Essex Hall >> 401 Sunset Avenue >> Windsor, Ontario >> Canada, N9B 3P4 >> Phone: 519-253-3000 Ext 3396 >> Email: serv...@uwindsor.ca >> >> ___ >> webkit-dev mailing list >> webkit-dev@lists.webkit.org >> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev >> >> > > ___ > webkit-dev mailing list > webkit-dev@lists.webkit.org > http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev > > ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
Re: [webkit-dev] Font Name
This should go to webkit.org/articles :) On Sat, May 21, 2011 at 1:55 PM, Mustafizur Rahaman wrote: > Hi, > > When you are drawing some text, you create a RenderText(RenderObject) > which has all the rendering info & the m_style of RenderText has the style > info required to render the text. > > Let's consider the following style data I have in my html page > > body.rahaman{ > font:30px courier; > } > > Rahaman > > Once the HTMLTreeBuilder parses the token, it creates HTMLStyleElement & > CSSStyleSheet & then asks the CSSParser to parse the StyleSheet. From there > it comes to CSSParser::parseValue()=>CSSParser::parseFont() as the I have > only used font property > > We create a FontValue (which contain all the attribute a font property can > have like style, size, variant, family etc=> in this font_family, you can > actually see the font name you have used ). In CSSParser::parseFont, we > populate the FontValue structure (you can find the font family name in > font->family), calls CSSParser::addProperty() where we create a CSSProperty > with the FontValue/CSSValue being passed & this property is being stored in > CSSParser::m_parsedProperties. > > Then we call CSSParser::createStyleRule where we used the > m_parsedProperties mentioned before to create a CSSMutableStyleDeclaration & > set this declaration for the CSSRule. > > We then create CSSStyleSelector and call CSSStyleSelector::styleForElement > for the root element. Here somehow (I don't have much details what happens > in berween but figured out that we retrieve the same > CSSMutableStyleDeclaration mentioned above) & call > CSSStyleSelector::applyProperty(). Here each StyleSelector has its > RenderStyle (m_style), where from we retrieve the FontDescription & add the > properties accordingly. On the other hand, each RenderObject (the > corresponding node in the RenderTree for a node in DOM tree) has > RenderStyle, which gets the value we retrieved above. > > Finally we call GraphicsContext::drawText() passing the Font which we have > retrieved from the RenderStyle we dsicussed above. > > I am not sure if this is what you were looking for, I just shared whatever > I knew of the related area. Please let me know if you need anything else. > > Thanks, > Rahaman > > > On Fri, May 20, 2011 at 12:22 AM, Soheil Servati Beiragh < > sserv...@yahoo.com> wrote: > >> Hi >> I want to know after webkit parses the html file where does it save the >> font that is used for text? It definitely won't save a name for the font but >> there should be some kind of index or sth to tell the rendering engine which >> font is being used. >> >> Thanks in advance >> >> *Soheil Servati Beiragh* >> *PhD Candidate, ECE Department, >> * >> *Research Center for Integrated Microsystems,* >> *University of Windsor.* >> Room 268 Essex Hall >> 401 Sunset Avenue >> Windsor, Ontario >> Canada, N9B 3P4 >> Phone: 519-253-3000 Ext 3396 >> Email: serv...@uwindsor.ca >> >> ___ >> webkit-dev mailing list >> webkit-dev@lists.webkit.org >> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev >> >> > > ___ > webkit-dev mailing list > webkit-dev@lists.webkit.org > http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev > > -- --Antonio Gomes ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
Re: [webkit-dev] Font Name
Hi, When you are drawing some text, you create a RenderText(RenderObject) which has all the rendering info & the m_style of RenderText has the style info required to render the text. Let's consider the following style data I have in my html page body.rahaman{ font:30px courier; } Rahaman Once the HTMLTreeBuilder parses the token, it creates HTMLStyleElement & CSSStyleSheet & then asks the CSSParser to parse the StyleSheet. From there it comes to CSSParser::parseValue()=>CSSParser::parseFont() as the I have only used font property We create a FontValue (which contain all the attribute a font property can have like style, size, variant, family etc=> in this font_family, you can actually see the font name you have used ). In CSSParser::parseFont, we populate the FontValue structure (you can find the font family name in font->family), calls CSSParser::addProperty() where we create a CSSProperty with the FontValue/CSSValue being passed & this property is being stored in CSSParser::m_parsedProperties. Then we call CSSParser::createStyleRule where we used the m_parsedProperties mentioned before to create a CSSMutableStyleDeclaration & set this declaration for the CSSRule. We then create CSSStyleSelector and call CSSStyleSelector::styleForElement for the root element. Here somehow (I don't have much details what happens in berween but figured out that we retrieve the same CSSMutableStyleDeclaration mentioned above) & call CSSStyleSelector::applyProperty(). Here each StyleSelector has its RenderStyle (m_style), where from we retrieve the FontDescription & add the properties accordingly. On the other hand, each RenderObject (the corresponding node in the RenderTree for a node in DOM tree) has RenderStyle, which gets the value we retrieved above. Finally we call GraphicsContext::drawText() passing the Font which we have retrieved from the RenderStyle we dsicussed above. I am not sure if this is what you were looking for, I just shared whatever I knew of the related area. Please let me know if you need anything else. Thanks, Rahaman On Fri, May 20, 2011 at 12:22 AM, Soheil Servati Beiragh wrote: > Hi > I want to know after webkit parses the html file where does it save the > font that is used for text? It definitely won't save a name for the font but > there should be some kind of index or sth to tell the rendering engine which > font is being used. > > Thanks in advance > > *Soheil Servati Beiragh* > *PhD Candidate, ECE Department, > * > *Research Center for Integrated Microsystems,* > *University of Windsor.* > Room 268 Essex Hall > 401 Sunset Avenue > Windsor, Ontario > Canada, N9B 3P4 > Phone: 519-253-3000 Ext 3396 > Email: serv...@uwindsor.ca > > ___ > webkit-dev mailing list > webkit-dev@lists.webkit.org > http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev > > ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
[webkit-dev] Font Name
Hi I want to know after webkit parses the html file where does it save the font that is used for text? It definitely won't save a name for the font but there should be some kind of index or sth to tell the rendering engine which font is being used. Thanks in advance Soheil Servati Beiragh PhD Candidate, ECE Department, Research Center for Integrated Microsystems, University of Windsor. Room 268 Essex Hall 401 Sunset Avenue Windsor, Ontario Canada, N9B 3P4 Phone: 519-253-3000 Ext 3396 Email: serv...@uwindsor.ca___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev