ARTTextFrame.h 834 B

1234567891011121314151617181920212223
  1. /*
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. #import <CoreText/CoreText.h>
  8. // A little helper to make sure we have a set of lines including width ready for use.
  9. // We assume that we will only this in one place so no reference counting is necessary.
  10. // Needs to be freed when deallocated.
  11. // This is fragile since this relies on these values not getting reused. Consider
  12. // wrapping these in an Obj-C class or some ARC hackery to get refcounting.
  13. typedef struct {
  14. size_t count;
  15. CGFloat baseLine; // Distance from the origin to the base line of the first line
  16. CGFloat lineHeight; // Distance between lines
  17. CTLineRef *lines;
  18. CGFloat *widths; // Width of each line
  19. } ARTTextFrame;