Closed Bug 166919 Opened 23 years ago Closed 23 years ago

[ps] nsAFMObject does not look up fonts correctly

Categories

(Core :: Printing: Output, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.2beta

People

(Reporter: rods, Assigned: rods)

Details

Attachments

(1 file, 2 obsolete files)

Status: NEW → ASSIGNED
OS: Windows 2000 → Linux
Target Milestone: --- → mozilla1.2beta
Attached patch patch (obsolete) — Splinter Review
As stated in the patch: Some aFontNames have a more than one font separated by a "," for example: "arial,serif" This chops the name up per the comma and checks each font name looking for a match, if not then it fails.
"when it fails" means it defaults to "times"
Attached patch patch with strtok (obsolete) — Splinter Review
Parse for font names, I can use strtok because I am comparing against char* names anyway.
Attachment #97995 - Attachment is obsolete: true
rods wrote: > Parse for font names, I can use strtok because I am comparing against char* > names anyway. What about using POSIX |strtok_r()| or |PR_strtok_r()| instead of using nsCRT:: ?
Attachment #98016 - Flags: superreview+
Summary: nsAFXObject does look up fonts correctly → [ps] nsAFMObject does look up fonts correctly
Um.. http://lxr.mozilla.org/seamonkey/source/gfx/public/nsFont.h#121 nsFont::EnumerateFamilies. It seems like it would be a good idea to use that here and not duplicate the parsing code from nsFont, no?
Comment on attachment 98016 [details] [diff] [review] patch with strtok r=dcone. I think this is the correct way to fix this. Just look at what we talked about.
Attachment #98016 - Flags: review+
Comment on attachment 98016 [details] [diff] [review] patch with strtok font-family: Times, "Bookman Antique, Condensed", Helvetica; I fail to see how parsing this with strtok can possibly be a good idea.
Attachment #98016 - Flags: needs-work+
Summary: [ps] nsAFMObject does look up fonts correctly → [ps] nsAFMObject does not look up fonts correctly
I don't understand why parsing with strtok is such a bad idea? Its simple, easy to maintain, gets the job done with a small amount of code. A space and a quote is all that would be needed in the token string to fix the problems in the example you give. I am not trying to argue or put any particular fix down.. I am just curious about why you think the strtok is so bad... is it overlooking anything that nsFont::EnumerateFamilies is doing and needs for this particular problem.. if its not.. it seems to be the faster.. less complex solution to this problem.
Attached patch patch with EnumSplinter Review
Yes, the font def is more complicated than I thought: http://www.w3.org/TR/REC-CSS2/fonts.html#font-family-prop This patch uses nsFont::EnumerateFamilies
Attachment #98016 - Attachment is obsolete: true
Comment on attachment 98441 [details] [diff] [review] patch with Enum r=dcone
Attachment #98441 - Flags: review+
Comment on attachment 98441 [details] [diff] [review] patch with Enum Rod, thanks. sr=bzbarsky if you add a null-check on the ToNewCString() return value and stop the enumeration if it returned null... Don, comment 8 has 3 font families listed. strtok would parse it as 4 font families.
Attachment #98441 - Flags: superreview+
fixed
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: