Returns the id of the shape that contains the given unichar and font. If not found, returns -1. If font_id < 0, the font_id is ignored and the first shape that matches the unichar_id is returned.
| 394 | // If font_id < 0, the font_id is ignored and the first shape that matches |
| 395 | // the unichar_id is returned. |
| 396 | int ShapeTable::FindShape(int unichar_id, int font_id) const { |
| 397 | for (int s = 0; s < shape_table_.size(); ++s) { |
| 398 | const Shape& shape = GetShape(s); |
| 399 | for (int c = 0; c < shape.size(); ++c) { |
| 400 | if (shape[c].unichar_id == unichar_id) { |
| 401 | if (font_id < 0) |
| 402 | return s; // We don't care about the font. |
| 403 | for (int f = 0; f < shape[c].font_ids.size(); ++f) { |
| 404 | if (shape[c].font_ids[f] == font_id) |
| 405 | return s; |
| 406 | } |
| 407 | } |
| 408 | } |
| 409 | } |
| 410 | return -1; |
| 411 | } |
| 412 | |
| 413 | // Returns the first unichar_id and font_id in the given shape. |
| 414 | void ShapeTable::GetFirstUnicharAndFont(int shape_id, |
no test coverage detected