Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: skia/ext/SkFontHost_fontconfig_ipc.cpp

Issue 147005: Linux: fix fake italics for font's without italic variants. (Closed)
Patch Set: ... Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « skia/ext/SkFontHost_fontconfig_ipc.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* libs/graphics/ports/SkFontHost_fontconfig_direct.cpp 1 /* libs/graphics/ports/SkFontHost_fontconfig_direct.cpp
2 ** 2 **
3 ** Copyright 2009, Google Inc. 3 ** Copyright 2009, Google Inc.
4 ** 4 **
5 ** Licensed under the Apache License, Version 2.0 (the "License"); 5 ** Licensed under the Apache License, Version 2.0 (the "License");
6 ** you may not use this file except in compliance with the License. 6 ** you may not use this file except in compliance with the License.
7 ** You may obtain a copy of the License at 7 ** You may obtain a copy of the License at
8 ** 8 **
9 ** http://www.apache.org/licenses/LICENSE-2.0 9 ** http://www.apache.org/licenses/LICENSE-2.0
10 ** 10 **
(...skipping 21 matching lines...) Expand all
32 : fd_(fd) { 32 : fd_(fd) {
33 } 33 }
34 34
35 FontConfigIPC::~FontConfigIPC() { 35 FontConfigIPC::~FontConfigIPC() {
36 close(fd_); 36 close(fd_);
37 } 37 }
38 38
39 bool FontConfigIPC::Match(std::string* result_family, 39 bool FontConfigIPC::Match(std::string* result_family,
40 unsigned* result_fileid, 40 unsigned* result_fileid,
41 bool fileid_valid, unsigned fileid, 41 bool fileid_valid, unsigned fileid,
42 const std::string& family, int is_bold, 42 const std::string& family, bool* is_bold,
43 int is_italic) { 43 bool* is_italic) {
44 Pickle request; 44 Pickle request;
45 request.WriteInt(METHOD_MATCH); 45 request.WriteInt(METHOD_MATCH);
46 request.WriteBool(fileid_valid); 46 request.WriteBool(fileid_valid);
47 if (fileid_valid) 47 if (fileid_valid)
48 request.WriteUInt32(fileid); 48 request.WriteUInt32(fileid);
49 request.WriteBool(is_bold); 49
50 request.WriteBool(is_italic); 50 request.WriteBool(is_bold && *is_bold);
51 request.WriteBool(is_bold && *is_italic);
52
51 request.WriteString(family); 53 request.WriteString(family);
52 54
53 uint8_t reply_buf[512]; 55 uint8_t reply_buf[512];
54 const ssize_t r = base::SendRecvMsg(fd_, reply_buf, sizeof(reply_buf), NULL, 56 const ssize_t r = base::SendRecvMsg(fd_, reply_buf, sizeof(reply_buf), NULL,
55 request); 57 request);
56 if (r == -1) 58 if (r == -1)
57 return false; 59 return false;
58 60
59 Pickle reply(reinterpret_cast<char*>(reply_buf), r); 61 Pickle reply(reinterpret_cast<char*>(reply_buf), r);
60 void* iter = NULL; 62 void* iter = NULL;
61 bool result; 63 bool result;
62 if (!reply.ReadBool(&iter, &result)) 64 if (!reply.ReadBool(&iter, &result))
63 return false; 65 return false;
64 if (!result) 66 if (!result)
65 return false; 67 return false;
66 68
67 uint32_t reply_fileid; 69 uint32_t reply_fileid;
68 std::string reply_family; 70 std::string reply_family;
71 bool resulting_bold, resulting_italic;
69 if (!reply.ReadUInt32(&iter, &reply_fileid) || 72 if (!reply.ReadUInt32(&iter, &reply_fileid) ||
70 !reply.ReadString(&iter, &reply_family)) { 73 !reply.ReadString(&iter, &reply_family) ||
74 !reply.ReadBool(&iter, &resulting_bold) ||
75 !reply.ReadBool(&iter, &resulting_italic)) {
71 return false; 76 return false;
72 } 77 }
73 78
74 *result_fileid = reply_fileid; 79 *result_fileid = reply_fileid;
75 if (result_family) 80 if (result_family)
76 *result_family = reply_family; 81 *result_family = reply_family;
77 82
83 if (is_bold)
84 *is_bold = resulting_bold;
85 if (is_italic)
86 *is_italic = resulting_italic;
87
78 return true; 88 return true;
79 } 89 }
80 90
81 int FontConfigIPC::Open(unsigned fileid) { 91 int FontConfigIPC::Open(unsigned fileid) {
82 Pickle request; 92 Pickle request;
83 request.WriteInt(METHOD_OPEN); 93 request.WriteInt(METHOD_OPEN);
84 request.WriteUInt32(fileid); 94 request.WriteUInt32(fileid);
85 95
86 int result_fd = -1; 96 int result_fd = -1;
87 uint8_t reply_buf[256]; 97 uint8_t reply_buf[256];
88 const ssize_t r = base::SendRecvMsg(fd_, reply_buf, sizeof(reply_buf), 98 const ssize_t r = base::SendRecvMsg(fd_, reply_buf, sizeof(reply_buf),
89 &result_fd, request); 99 &result_fd, request);
90 100
91 if (r == -1) 101 if (r == -1)
92 return -1; 102 return -1;
93 103
94 Pickle reply(reinterpret_cast<char*>(reply_buf), r); 104 Pickle reply(reinterpret_cast<char*>(reply_buf), r);
95 bool result; 105 bool result;
96 void* iter = NULL; 106 void* iter = NULL;
97 if (!reply.ReadBool(&iter, &result) || 107 if (!reply.ReadBool(&iter, &result) ||
98 !result) { 108 !result) {
99 if (result_fd) 109 if (result_fd)
100 close(result_fd); 110 close(result_fd);
101 return -1; 111 return -1;
102 } 112 }
103 113
104 return result_fd; 114 return result_fd;
105 } 115 }
OLDNEW
« no previous file with comments | « skia/ext/SkFontHost_fontconfig_ipc.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698