//
//  GSLayer+ImportOutlines.h
//  GlyphsCore
//
//  Created by Georg Seifert on 17.05.20.
//  Copyright © 2020 schriftgestaltung.de. All rights reserved.
//

#import <GlyphsCore/GSLayer.h>

NS_ASSUME_NONNULL_BEGIN

@interface GSLayer (ImportOutlines)

/// Whether a file name identifies a supported outline format.
///
/// SVG, EPS, and PDF files are supported.
+ (BOOL)canImportOutlinesFromFile:(NSString *)fileName;

/// Whether a file URL identifies a supported outline format.
///
/// SVG, EPS, and PDF files are supported.
+ (BOOL)canImportOutlinesFromURL:(NSURL *)fileURL;

/// Imports outlines and adds them to the layer.
///
/// The imported outlines become the selection.
///
/// - Parameter fileURL: The URL of an SVG, EPS, or PDF file.
/// - Parameter scale: The scale applied while reading the file.
/// - Parameter error: On failure, information about the error.
/// - Returns: Whether the outlines were imported.
- (BOOL)importOutlinesFromURL:(NSURL *)fileURL scale:(CGFloat)scale error:(out NSError **)error;

#ifndef GLYPHS_LITE
/// Scales the layer contents to the vertical span of the glyph metrics.
///
/// A rectangular path enclosing the other content is treated as the source bounds and removed.
///
/// - Parameter layerMetrics: The target vertical metrics.
/// - Parameter bounds: The source bounds to use when the layer has no enclosing rectangular path.
- (void)scaleToFullHeight:(GSGlyphMetrics)layerMetrics bounds:(NSRect)bounds;
#endif

@end

NS_ASSUME_NONNULL_END
