| 78 | } |
| 79 | |
| 80 | TextUtil * |
| 81 | TextUtil::create(const FontDescription &d) noexcept |
| 82 | { |
| 83 | jint paramStyle, paramTextSize; |
| 84 | |
| 85 | paramStyle = 0; |
| 86 | if (d.IsBold()) |
| 87 | paramStyle |= 1; |
| 88 | if (d.IsItalic()) |
| 89 | paramStyle |= 2; |
| 90 | paramTextSize = d.GetHeight(); |
| 91 | |
| 92 | int paint_flags = 0; |
| 93 | if (!IsDithered()) |
| 94 | /* 1 = Paint.ANTI_ALIAS_FLAG */ |
| 95 | paint_flags |= 1; |
| 96 | |
| 97 | // construct org.xcsoar.TextUtil object |
| 98 | auto &e = *env; |
| 99 | Java::LocalObject localObject{&e, |
| 100 | e.NewObject(cls, midTextUtil, |
| 101 | paramStyle, paramTextSize, |
| 102 | paint_flags, d.IsMonospace())}; |
| 103 | Java::RethrowException(&e); |
| 104 | |
| 105 | assert(localObject); |
| 106 | |
| 107 | return new TextUtil(localObject); |
| 108 | } |
| 109 | |
| 110 | PixelSize |
| 111 | TextUtil::getTextBounds(std::string_view text) const noexcept |
no test coverage detected