//
//  GSLayer+AlignComponents.h
//  GlyphsCore
//
//  Created by Georg Seifert on 21.07.18.
//  Copyright © 2018 schriftgestaltung.de. All rights reserved.
//

#import <GlyphsCore/GSLayer.h>
/**
 Layer Align Components
 */
@interface GSLayer (AlignComponents)

#ifndef LIBCORE
/// Aligns components according to their alignment settings.
///
/// This updates component positions and layer width where automatic alignment applies.
- (void)alignComponents;

/// Aligns components according to their alignment settings.
///
/// - Parameter wait: Whether to wait for an alignment operation that is already in progress.
- (void)alignComponents:(BOOL)wait;

/// Performs component alignment immediately.
///
/// - Returns: `YES` when component alignment could be applied.
- (BOOL)doAlignComponents;

/// Whether component alignment needs to be updated.
- (BOOL)needsAlignment;

/// Whether automatic component alignment can be applied to the layer.
- (BOOL)checkIfAlign;

/// Applies automatic width alignment.
- (void)doAlignWidth;

/// Metrics key offsets used by automatic component alignment.
///
/// - Parameter leftOffset: On return, the left side-bearing offset.
/// - Parameter rightOffset: On return, the right side-bearing offset.
/// - Parameter width: On return, the width from the width metrics key, or `NSNotFound`.
- (void)metricKeyOffsetLeft:(out CGFloat *)leftOffset right:(out CGFloat *)rightOffset width:(out CGFloat *)width NS_REFINED_FOR_SWIFT;
#endif

@end
