Closed
Bug 437356
Opened 16 years ago
Closed 16 years ago
set up shared font entry object
Categories
(Core :: Graphics, defect, P1)
Core
Graphics
Tracking
()
RESOLVED
FIXED
People
(Reporter: jtd, Assigned: jtd)
References
Details
Attachments
(1 file, 5 obsolete files)
130.26 KB,
patch
|
pavlov
:
review+
pavlov
:
superreview+
|
Details | Diff | Splinter Review |
On Mac/Windows we set up a FontEntry object to contain data related to a given font face. For user-downloaded fonts, we need separate objects to track these. First step is to share code between platforms so that this can be shared with user font objects. This will add a small amount of overhead but should reduce the amount of platform-specific code needed for font matching and available weight lookups. Using the QT code set up by Stuart as a starting point to create a shared version for Mac/Windows, then Linux.
Assignee | ||
Updated•16 years ago
|
Blocks: font-stretch
Assignee | ||
Comment 1•16 years ago
|
||
Basic idea is to pull font matching code into common code shared across platforms. A font entry represents a single underlying font face, a font family a set of faces. Font matching decisions are made in common code attached to the font group. This will also allow the font matching code on Windows/Mac to be used on Linux. Based on Stuart's gfxQtFonts version, with selected features from Windows/Mac as needed. gfxFontEntry ==> represents underlying font family PRBool TestCharacterMap(PRUint32 aCh); nsresult ReadCMAP(); gfxFontFamily ==> represents underlying font face, set of gfxFontEntry gfxFontEntry *FindFontForStyle(const gfxFontStyle& aFontStyle, PRBool& aNeedsBold); gfxFont ==> matched font <font entry, style> gfxTextRange ==> utility struct for recording font matches gfxFontGroup ==> set of matched fonts gfxFont *FindFontForChar(PRUint32 ch, PRUint32 prevCh, PRUint32 nextCh, gfxFont *aFont); PRUint32 ComputeRanges(nsTArray<TextRange>& mRanges, nsString& mString); PRBool HasCharacter(gfxFont *aFont, PRUint32 ch); gfxFontEntry* WhichFontSupportsChar(const nsTArray<nsRefPtr<gfxFontEntry> >& foo, PRUint32 ch); gfxFontEntry* WhichPrefFontSupportsChar(PRUint32 aCh) gfxPlatform ==> pref font lists, general lookups gfxFontFamily *FindFontFamily(const nsAString& aName); gfxFontEntry *FindFontEntry(const nsAString& aName, const gfxFontStyle& aFontStyle); gfxFontEntry* FindFontForChar(const PRUint32 aCh, gfxFont *aPrevFont); GetPrefFontEntries(const nsCString& aKey, nsTArray<nsRefPtr<gfxFontEntry> > *array) SetPrefFontEntries(const nsCString& aKey, nsTArray<nsRefPtr<gfxFontEntry> >& array)
Comment 2•16 years ago
|
||
see also bug 366664.
Assignee | ||
Comment 3•16 years ago
|
||
This patch implements font matching under Mac OS X via generic font matching code in gfxFontGroup using code based on Stuart's Qt font handling code. The ComputeRanges routine sets up an array of ranges within a string, each with an associated font. ComputeRange calls FindFontForChar_NFE on each character, which tests the cmaps of fonts in the font group, followed by pref fonts and system fonts. Pref font and system fonts are handled in WhichPrefFontSupportsChar_NFE and WhichSystemFontSupportsChar_NFE. The _NFE suffix is temporary until I can move this over to all platforms. As a result, the font matching code I wrote in gfxAtsuiFonts (CmapFontMatcher) goes away (sniffle, sniffle...). Platform-specific font objects inherit from: gfxFontEntry - style information (italic, weight, etc.) - character map gfxFontFamily - maps <font family, style> ==> gfxFontEntry (FindFontForStyle) - style ==> list of weights handled by platform-specific code (FindWeightsForStyle) So if platform X needs to implement font matching, they will need: - setup code in InitTextRun to call ComputeRanges and then interface with the platform layout code - appropriate methods for WhichPrefFontSupportsChar_NFE and WhichSystemFontSupportsChar_NFE - subclasses of gfxFontEntry/gfxFontFamily to implement TestCharacterMap The next step is to get this running on Windows, then wait for Stuart to get back so he has a chance to evaluate this before I attempt to work on the Linux version.
Assignee | ||
Updated•16 years ago
|
Attachment #326434 -
Attachment is patch: true
Attachment #326434 -
Attachment mime type: application/octet-stream → text/plain
Assignee | ||
Comment 5•16 years ago
|
||
Move ComputeRanges out of UniscribeItem code and use generic version in gfxFontGroup. Need to move the CJK pref handling code into gfxPlatform and reduce it.
Assignee | ||
Comment 6•16 years ago
|
||
FindFontEntry now uses generic style matching. Next step is to make sure this compiles on Linux, figure out how to integrate into Pango or FT code.
Attachment #326434 -
Attachment is obsolete: true
Attachment #326857 -
Attachment is obsolete: true
Assignee | ||
Comment 7•16 years ago
|
||
Attachment #327380 -
Attachment is obsolete: true
Assignee | ||
Comment 8•16 years ago
|
||
Cleanup procedure names.
Attachment #327568 -
Attachment is obsolete: true
Assignee | ||
Comment 9•16 years ago
|
||
Comment on attachment 328314 [details] [diff] [review] patch, v.0.5, cleanup Ok, I think this should be good for now. I'd like to move the name completely out of gfxFont but that would mean doing more work on the Linux font code. I'll spin off a separate bug for that. Follow-on work will happen with bug 441473.
Attachment #328314 -
Flags: superreview?(pavlov)
Attachment #328314 -
Flags: review?(pavlov)
Comment 10•16 years ago
|
||
Comment on attachment 328314 [details] [diff] [review] patch, v.0.5, cleanup i'd really like +gfxFont::gfxFont(const nsAString &aName, const gfxFontStyle *aFontStyle, gfxFontEntry *aFontEntry) : to just take a FontEntry and Style (in that order) I might suggest renaming FontEntry to FontFace as well. otherwise, this looks great. good job.
Assignee | ||
Comment 11•16 years ago
|
||
Adjust the gfxFont constructor to only take a font entry, style. gfxPangoFont is initialized with a stub version of a gfxPangoFontEntry that is only used for the name. Decided not to rename FontEntry ==> FontFace right now as this will cause all sorts of pain in follow-on patches at this point.
Attachment #328314 -
Attachment is obsolete: true
Attachment #332183 -
Flags: superreview?(pavlov)
Attachment #332183 -
Flags: review?(pavlov)
Attachment #328314 -
Flags: superreview?(pavlov)
Attachment #328314 -
Flags: review?(pavlov)
Assignee | ||
Updated•16 years ago
|
Attachment #332183 -
Attachment description: patch, v.0.5, const for gfxFont takes font entry, style → patch, v.0.6, const for gfxFont takes font entry, style
Updated•16 years ago
|
Attachment #332183 -
Flags: superreview?(pavlov)
Attachment #332183 -
Flags: superreview+
Attachment #332183 -
Flags: review?(pavlov)
Attachment #332183 -
Flags: review+
Assignee | ||
Comment 12•16 years ago
|
||
checked in
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•