We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
`public func getGlyphWidths(text: String) -> [Float] { var paint: Paint? = nil var textChar = Character
var n = countGlyphs(str: text) if n <= 0 { return [Float]() } var widths: [Float] = Array.init (repeating: Float.zero, count: Int(n)) var bounds: [Rect] = Array.init (repeating: Rect(width: 0, height: 0), count: Int(n)) var w: UnsafeMutablePointer<Float>? = nil if !widths.isEmpty { w = UnsafeMutablePointer<Float>.allocate(capacity: widths.count) w?.initialize(from: &widths, count: widths.count) } var b: UnsafeMutablePointer<Rect>? = nil if !bounds.isEmpty { b = UnsafeMutablePointer<Rect>.allocate(capacity: bounds.count) b?.initialize(from: &bounds, count: bounds.count) } if var glyphs = getGlyphs(str: text) { sk_font_get_widths_bounds(handle, &glyphs, Int32 (glyphs.count), w, b, paint?.handle) } // Deallocate memory and free pointers when done w?.deallocate() b?.deallocate() return widths }
` I have implemented the above API, could you please let me know if there is something that i missed here?
The text was updated successfully, but these errors were encountered:
For some reason the format is not working for me, but i hope the code i pasted is readable. Any help is appreciated. Thanks!
Sorry, something went wrong.
No branches or pull requests
`public func getGlyphWidths(text: String) -> [Float] {
var paint: Paint? = nil
var textChar = Character
`
I have implemented the above API, could you please let me know if there is something that i missed here?
The text was updated successfully, but these errors were encountered: