| OLD | NEW |
| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 return (fileid << 4) | face_index; | 99 return (fileid << 4) | face_index; |
| 100 } | 100 } |
| 101 | 101 |
| 102 } // anonymous namespace | 102 } // anonymous namespace |
| 103 | 103 |
| 104 FontConfigDirect::FontConfigDirect() | 104 FontConfigDirect::FontConfigDirect() |
| 105 : next_file_id_(0) { | 105 : next_file_id_(0) { |
| 106 FcInit(); | 106 FcInit(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 FontConfigDirect::~FontConfigDirect() { |
| 110 } |
| 111 |
| 109 // ----------------------------------------------------------------------------- | 112 // ----------------------------------------------------------------------------- |
| 110 // Normally we only return exactly the font asked for. In last-resort | 113 // Normally we only return exactly the font asked for. In last-resort |
| 111 // cases, the request either doesn't specify a font or is one of the | 114 // cases, the request either doesn't specify a font or is one of the |
| 112 // basic font names like "Sans", "Serif" or "Monospace". This function | 115 // basic font names like "Sans", "Serif" or "Monospace". This function |
| 113 // tells you whether a given request is for such a fallback. | 116 // tells you whether a given request is for such a fallback. |
| 114 // ----------------------------------------------------------------------------- | 117 // ----------------------------------------------------------------------------- |
| 115 static bool IsFallbackFontAllowed(const std::string& family) | 118 static bool IsFallbackFontAllowed(const std::string& family) |
| 116 { | 119 { |
| 117 const char* family_cstr = family.c_str(); | 120 const char* family_cstr = family.c_str(); |
| 118 return family.empty() || | 121 return family.empty() || |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 | 364 |
| 362 int FontConfigDirect::Open(unsigned filefaceid) { | 365 int FontConfigDirect::Open(unsigned filefaceid) { |
| 363 SkAutoMutexAcquire ac(mutex_); | 366 SkAutoMutexAcquire ac(mutex_); |
| 364 const std::map<unsigned, std::string>::const_iterator | 367 const std::map<unsigned, std::string>::const_iterator |
| 365 i = fileid_to_filename_.find(FileFaceIdToFileId(filefaceid)); | 368 i = fileid_to_filename_.find(FileFaceIdToFileId(filefaceid)); |
| 366 if (i == fileid_to_filename_.end()) | 369 if (i == fileid_to_filename_.end()) |
| 367 return -1; | 370 return -1; |
| 368 | 371 |
| 369 return open(i->second.c_str(), O_RDONLY); | 372 return open(i->second.c_str(), O_RDONLY); |
| 370 } | 373 } |
| OLD | NEW |