Skia's default font?

1,514 views
Skip to first unread message

jjyoo

unread,
Sep 9, 2012, 4:00:16 AM9/9/12
to skia-d...@googlegroups.com
 
Hello skia-discuss,
 
I run golden master benchmark (lcdtxt.cpp)
In this application, I saw that a simple text is drawn.
What is the default font family (for example, serif, sans-serif, cursive, fantasy, monospace, etc) when we call drawText(..) method?
 
Thank you in advance.
 
 

bungeman

unread,
Sep 9, 2012, 10:13:24 AM9/9/12
to skia-d...@googlegroups.com
The default font is determined by the SkFontHost. In the existing font hosts the default font is the system's default font. For example, on Windows the default font will be the GDI default fallback font (the font returned when using an empty LOGFONT). Often (as in this case) Skia didn't pick the default font directly. Skia provides no simple reliable means of knowing which font it was that was picked, as it is possible that Skia with some font hosts may not know this either.

jjyoo

unread,
Sep 11, 2012, 10:28:22 PM9/11/12
to skia-discuss
Thank you bungeman,

I have another question to all skia discuss member,

what is the role of the following function in lcdtext.cpp (skia golden
master bench)

setLCDRenderText(..)

Although I read the source code comment and do googling, I cannot find
the exact role of that.

Thank you in advance.
> > Thank you in advance.- Hide quoted text -
>
> - Show quoted text -

bungeman

unread,
Sep 12, 2012, 9:06:04 AM9/12/12
to skia-d...@googlegroups.com
There are two calls which should not be confused, setLCDRenderText and setSubpixelText. The setLCDRenderText(true) call is a hint that lcd font smoothing should be used, if possible; this means that Skia will try to exploit any known subpixel geometry in rendering glyphs (like ClearType). The setSubpixelText(true) call is a hint that subpixel positioning should be used, if possible; this means that glyphs do not have to be snapped to pixel boundaries which improves kerning. These two settings are independent, each can be set without the other. Neither of them is effective if isAntiAlias is false.

Mike Reed

unread,
Sep 12, 2012, 10:31:21 AM9/12/12
to skia-d...@googlegroups.com
Perhaps we should capture some of this explanation in our .h comment/dox
> --
> You received this message because you are subscribed to the Google Groups
> "skia-discuss" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/skia-discuss/-/lJ9dBZ0m6mwJ.
>
> To post to this group, send email to skia-d...@googlegroups.com.
> To unsubscribe from this group, send email to
> skia-discuss...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/skia-discuss?hl=en.

jjyoo

unread,
Sep 13, 2012, 12:21:09 AM9/13/12
to skia-discuss
Thank you again bungeman,

So, you mean that

setSubpixelText(true) is an API for font kerning (setting) and,
setLCDRenderText(true) is an API for subpixel rendering (setting)?

font kerning (http://en.wikipedia.org/wiki/Kerning)
subpixel rendering (http://en.wikipedia.org/wiki/Subpixel_rendering)
> >http://groups.google.com/group/skia-discuss?hl=en.- Hide quoted text -

Mike Reed

unread,
Sep 13, 2012, 8:58:30 AM9/13/12
to skia-d...@googlegroups.com
SubpixelText means that we may slide the image of a character a
fraction of a pixel (and re-image from the outline) in an attempt to
respect positions/advances that are fractional. It affects the
position of the character's outline before it is converted to pixels
(by shifting it slightly).

e.g.
drawText("H", 0, 10, ...)
and
drawText("H", 0.25, 10, ...)

If there is no subpixel positioning, both of these H letters will land
on the same pixel (x=0), since pixels are at integral positions. With
subpixel positioning, the 2nd H will be at pixel x=0, but its image
will have been shifted slightly to the right, affecting all of its
pixels.


LCDRender just means that we take advantage of the R,G,B color
components in a given pixel to make the antialiasing look better.
Reply all
Reply to author
Forward
0 new messages