[ios, macos] Add "includesIdeographicGlyphs" option to MGLOfflineRegion.

This commit is contained in:
Chris Loer
2018-12-18 17:26:31 -08:00
committed by Chris Loer
parent 990e3874f4
commit 387fa1800f
8 changed files with 109 additions and 53 deletions

View File

@@ -19,6 +19,19 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (nonatomic, readonly) NSURL *styleURL;
/**
Specifies whether to include ideographic glyphs in downloaded font data.
Ideographic glyphs make up the majority of downloaded font data, but
it is possible to configure the renderer to use locally installed fonts
instead of relying on fonts downloaded as part of the offline pack.
See `MGLIdeographicFontFamilyName` setting. Also, for regions outside of
China, Japan, and Korea, these glyphs will rarely appear for non-CJK users.
By default, this property is set to `YES`, so that the offline pack will
include ideographic glyphs.
*/
@property (nonatomic) BOOL includesIdeographicGlyphs;
@end
NS_ASSUME_NONNULL_END

View File

@@ -26,6 +26,7 @@
}
@synthesize styleURL = _styleURL;
@synthesize includesIdeographicGlyphs = _includesIdeographicGlyphs;
-(NSDictionary *)offlineStartEventAttributes {
return @{
@@ -71,6 +72,7 @@
_shape = shape;
_minimumZoomLevel = minimumZoomLevel;
_maximumZoomLevel = maximumZoomLevel;
_includesIdeographicGlyphs = YES;
}
return self;
}
@@ -78,7 +80,9 @@
- (instancetype)initWithOfflineRegionDefinition:(const mbgl::OfflineGeometryRegionDefinition &)definition {
NSURL *styleURL = [NSURL URLWithString:@(definition.styleURL.c_str())];
MGLShape *shape = MGLShapeFromGeoJSON(definition.geometry);
return [self initWithStyleURL:styleURL shape:shape fromZoomLevel:definition.minZoom toZoomLevel:definition.maxZoom];
MGLShapeOfflineRegion* result = [self initWithStyleURL:styleURL shape:shape fromZoomLevel:definition.minZoom toZoomLevel:definition.maxZoom];
result.includesIdeographicGlyphs = definition.includeIdeographs;
return result;
}
- (const mbgl::OfflineRegionDefinition)offlineRegionDefinition {
@@ -90,7 +94,7 @@
return mbgl::OfflineGeometryRegionDefinition(_styleURL.absoluteString.UTF8String,
_shape.geometryObject,
_minimumZoomLevel, _maximumZoomLevel,
scaleFactor);
scaleFactor, _includesIdeographicGlyphs);
}
- (nullable instancetype)initWithCoder:(NSCoder *)coder {
@@ -100,7 +104,9 @@
double minimumZoomLevel = [coder decodeDoubleForKey:@"minimumZoomLevel"];
double maximumZoomLevel = [coder decodeDoubleForKey:@"maximumZoomLevel"];
return [self initWithStyleURL:styleURL shape:shape fromZoomLevel:minimumZoomLevel toZoomLevel:maximumZoomLevel];
MGLShapeOfflineRegion* result = [self initWithStyleURL:styleURL shape:shape fromZoomLevel:minimumZoomLevel toZoomLevel:maximumZoomLevel];
result.includesIdeographicGlyphs = [coder decodeBoolForKey:@"includesIdeographicGlyphs"];
return result;
}
- (void)encodeWithCoder:(NSCoder *)coder
@@ -109,10 +115,13 @@
[coder encodeObject:_shape forKey:@"shape"];
[coder encodeDouble:_maximumZoomLevel forKey:@"maximumZoomLevel"];
[coder encodeDouble:_minimumZoomLevel forKey:@"minimumZoomLevel"];
[coder encodeBool:_includesIdeographicGlyphs forKey:@"includesIdeographicGlyphs"];
}
- (id)copyWithZone:(nullable NSZone *)zone {
return [[[self class] allocWithZone:zone] initWithStyleURL:_styleURL shape:_shape fromZoomLevel:_minimumZoomLevel toZoomLevel:_maximumZoomLevel];
MGLShapeOfflineRegion* result = [[[self class] allocWithZone:zone] initWithStyleURL:_styleURL shape:_shape fromZoomLevel:_minimumZoomLevel toZoomLevel:_maximumZoomLevel];
result.includesIdeographicGlyphs = _includesIdeographicGlyphs;
return result;
}
- (BOOL)isEqual:(id)other {
@@ -127,13 +136,15 @@
return (_minimumZoomLevel == otherRegion->_minimumZoomLevel
&& _maximumZoomLevel == otherRegion->_maximumZoomLevel
&& _shape.geometryObject == otherRegion->_shape.geometryObject
&& [_styleURL isEqual:otherRegion->_styleURL]);
&& [_styleURL isEqual:otherRegion->_styleURL]
&& _includesIdeographicGlyphs == otherRegion->_includesIdeographicGlyphs);
}
- (NSUInteger)hash {
return (_styleURL.hash
+ _shape.hash
+ @(_minimumZoomLevel).hash + @(_maximumZoomLevel).hash);
+ @(_minimumZoomLevel).hash + @(_maximumZoomLevel).hash
+ @(_includesIdeographicGlyphs).hash);
}
@end

View File

@@ -23,6 +23,7 @@
}
@synthesize styleURL = _styleURL;
@synthesize includesIdeographicGlyphs = _includesIdeographicGlyphs;
-(NSDictionary *)offlineStartEventAttributes {
return @{
@@ -67,6 +68,7 @@
_bounds = bounds;
_minimumZoomLevel = minimumZoomLevel;
_maximumZoomLevel = maximumZoomLevel;
_includesIdeographicGlyphs = YES;
}
return self;
}
@@ -74,7 +76,9 @@
- (instancetype)initWithOfflineRegionDefinition:(const mbgl::OfflineTilePyramidRegionDefinition &)definition {
NSURL *styleURL = [NSURL URLWithString:@(definition.styleURL.c_str())];
MGLCoordinateBounds bounds = MGLCoordinateBoundsFromLatLngBounds(definition.bounds);
return [self initWithStyleURL:styleURL bounds:bounds fromZoomLevel:definition.minZoom toZoomLevel:definition.maxZoom];
MGLTilePyramidOfflineRegion* result = [self initWithStyleURL:styleURL bounds:bounds fromZoomLevel:definition.minZoom toZoomLevel:definition.maxZoom];
result.includesIdeographicGlyphs = definition.includeIdeographs;
return result;
}
- (const mbgl::OfflineRegionDefinition)offlineRegionDefinition {
@@ -86,7 +90,7 @@
return mbgl::OfflineTilePyramidRegionDefinition(_styleURL.absoluteString.UTF8String,
MGLLatLngBoundsFromCoordinateBounds(_bounds),
_minimumZoomLevel, _maximumZoomLevel,
scaleFactor);
scaleFactor, _includesIdeographicGlyphs);
}
- (nullable instancetype)initWithCoder:(NSCoder *)coder {
@@ -100,7 +104,9 @@
double minimumZoomLevel = [coder decodeDoubleForKey:@"minimumZoomLevel"];
double maximumZoomLevel = [coder decodeDoubleForKey:@"maximumZoomLevel"];
return [self initWithStyleURL:styleURL bounds:bounds fromZoomLevel:minimumZoomLevel toZoomLevel:maximumZoomLevel];
MGLTilePyramidOfflineRegion* result = [self initWithStyleURL:styleURL bounds:bounds fromZoomLevel:minimumZoomLevel toZoomLevel:maximumZoomLevel];
result.includesIdeographicGlyphs = [coder decodeBoolForKey:@"includesIdeographicGlyphs"];
return result;
}
- (void)encodeWithCoder:(NSCoder *)coder
@@ -112,10 +118,13 @@
[coder encodeDouble:_bounds.ne.longitude forKey:@"northEastLongitude"];
[coder encodeDouble:_maximumZoomLevel forKey:@"maximumZoomLevel"];
[coder encodeDouble:_minimumZoomLevel forKey:@"minimumZoomLevel"];
[coder encodeBool:_includesIdeographicGlyphs forKey:@"includesIdeographicGlyphs"];
}
- (id)copyWithZone:(nullable NSZone *)zone {
return [[[self class] allocWithZone:zone] initWithStyleURL:_styleURL bounds:_bounds fromZoomLevel:_minimumZoomLevel toZoomLevel:_maximumZoomLevel];
MGLTilePyramidOfflineRegion* result = [[[self class] allocWithZone:zone] initWithStyleURL:_styleURL bounds:_bounds fromZoomLevel:_minimumZoomLevel toZoomLevel:_maximumZoomLevel];
result.includesIdeographicGlyphs = _includesIdeographicGlyphs;
return result;
}
- (BOOL)isEqual:(id)other {
@@ -130,14 +139,16 @@
return (_minimumZoomLevel == otherRegion->_minimumZoomLevel
&& _maximumZoomLevel == otherRegion->_maximumZoomLevel
&& MGLCoordinateBoundsEqualToCoordinateBounds(_bounds, otherRegion->_bounds)
&& [_styleURL isEqual:otherRegion->_styleURL]);
&& [_styleURL isEqual:otherRegion->_styleURL]
&& _includesIdeographicGlyphs == otherRegion->_includesIdeographicGlyphs);
}
- (NSUInteger)hash {
return (_styleURL.hash
+ @(_bounds.sw.latitude).hash + @(_bounds.sw.longitude).hash
+ @(_bounds.ne.latitude).hash + @(_bounds.ne.longitude).hash
+ @(_minimumZoomLevel).hash + @(_maximumZoomLevel).hash);
+ @(_minimumZoomLevel).hash + @(_maximumZoomLevel).hash
+ @(_includesIdeographicGlyphs).hash);
}
@end

View File

@@ -25,8 +25,9 @@
XCTAssertEqualObjects(original.styleURL, copy.styleURL, @"Style URL has changed.");
XCTAssert(MGLCoordinateBoundsEqualToCoordinateBounds(original.bounds, copy.bounds), @"Bounds have changed.");
XCTAssertEqual(original.minimumZoomLevel, original.minimumZoomLevel, @"Minimum zoom level has changed.");
XCTAssertEqual(original.maximumZoomLevel, original.maximumZoomLevel, @"Maximum zoom level has changed.");
XCTAssertEqual(original.minimumZoomLevel, copy.minimumZoomLevel, @"Minimum zoom level has changed.");
XCTAssertEqual(original.maximumZoomLevel, copy.maximumZoomLevel, @"Maximum zoom level has changed.");
XCTAssertEqual(original.includesIdeographicGlyphs, copy.includesIdeographicGlyphs, @"Include ideographs has changed.");
}
- (void)testGeometryRegionEquality {
@@ -36,13 +37,15 @@
XCTAssertNil(error);
MGLShapeOfflineRegion *original = [[MGLShapeOfflineRegion alloc] initWithStyleURL:[MGLStyle lightStyleURLWithVersion:MGLStyleDefaultVersion] shape:shape fromZoomLevel:5 toZoomLevel:10];
original.includesIdeographicGlyphs = NO;
MGLShapeOfflineRegion *copy = [original copy];
XCTAssertEqualObjects(original, copy, @"Shape region should be equal to its copy.");
XCTAssertEqualObjects(original.styleURL, copy.styleURL, @"Style URL has changed.");
XCTAssertEqualObjects(original.shape, copy.shape, @"Geometry has changed.");
XCTAssertEqual(original.minimumZoomLevel, original.minimumZoomLevel, @"Minimum zoom level has changed.");
XCTAssertEqual(original.maximumZoomLevel, original.maximumZoomLevel, @"Maximum zoom level has changed.");
XCTAssertEqual(original.minimumZoomLevel, copy.minimumZoomLevel, @"Minimum zoom level has changed.");
XCTAssertEqual(original.maximumZoomLevel, copy.maximumZoomLevel, @"Maximum zoom level has changed.");
XCTAssertEqual(original.includesIdeographicGlyphs, copy.includesIdeographicGlyphs, @"Include ideographs has changed.");
}
@end

View File

@@ -140,7 +140,7 @@
MGLShape *shape = [MGLShape shapeWithData: [geojson dataUsingEncoding:NSUTF8StringEncoding] encoding: NSUTF8StringEncoding error:&error];
XCTAssertNil(error);
MGLShapeOfflineRegion *region = [[MGLShapeOfflineRegion alloc] initWithStyleURL:styleURL shape:shape fromZoomLevel:zoomLevel toZoomLevel:zoomLevel];
region.includesIdeographicGlyphs = NO;
NSString *nameKey = @"Name";
NSString *name = @"Utrecht centrum";

View File

@@ -102,7 +102,9 @@ static NSString * const MBXOfflinePacksTableViewActiveCellReuseIdentifier = @"Ac
name = nameField.placeholder;
}
NSString *fontFamilyName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"MGLIdeographicFontFamilyName"];
MGLTilePyramidOfflineRegion *region = [[MGLTilePyramidOfflineRegion alloc] initWithStyleURL:mapView.styleURL bounds:mapView.visibleCoordinateBounds fromZoomLevel:mapView.zoomLevel toZoomLevel:mapView.maximumZoomLevel];
region.includesIdeographicGlyphs = fontFamilyName;
NSData *context = [NSKeyedArchiver archivedDataWithRootObject:@{
MBXOfflinePackContextNameKey: name,
}];

View File

@@ -1,14 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14306.4" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14306.4"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="MapDocument">
<connections>
<outlet property="addOfflinePackWindow" destination="NmZ-Tf-v2O" id="ZPE-9L-vPJ"/>
<outlet property="includeIdeographsBox" destination="Jbt-z6-eg9" id="bsz-FH-emx"/>
<outlet property="mapView" destination="q4d-kF-8Hi" id="7hI-dS-A5R"/>
<outlet property="mapViewContextMenu" destination="XbX-6a-Mgy" id="YD0-1r-5N2"/>
<outlet property="maximumOfflinePackZoomLevelField" destination="5sj-XD-neD" id="Edu-lU-3j9"/>
@@ -55,10 +56,10 @@
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" fullSizeContentView="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="388" y="211" width="642" height="480"/>
<rect key="screenRect" x="0.0" y="0.0" width="1280" height="777"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<view key="contentView" id="TuG-C5-zLS">
<rect key="frame" x="0.0" y="0.0" width="642" height="480"/>
<autoresizingMask key="autoresizingMask"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<splitView autosaveName="MBXLayersSplitView" dividerStyle="thin" vertical="YES" translatesAutoresizingMaskIntoConstraints="NO" id="IPR-fm-vk8">
<rect key="frame" x="0.0" y="0.0" width="642" height="480"/>
@@ -130,11 +131,11 @@
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="185" id="VQs-2Z-hmP"/>
</constraints>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="NDx-rn-TLj">
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="NDx-rn-TLj">
<rect key="frame" x="0.0" y="464" width="163" height="16"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="NO" id="0vt-rI-sHB">
<scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="0vt-rI-sHB">
<rect key="frame" x="147" y="480" width="16" height="0.0"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
@@ -310,38 +311,38 @@
<window title="Add Offline Pack" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="NmZ-Tf-v2O">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="109" y="131" width="392" height="192"/>
<rect key="screenRect" x="0.0" y="0.0" width="1280" height="777"/>
<view key="contentView" id="Aqq-bl-feU">
<rect key="frame" x="0.0" y="0.0" width="392" height="192"/>
<rect key="contentRect" x="109" y="131" width="392" height="221"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<view key="contentView" misplaced="YES" id="Aqq-bl-feU">
<rect key="frame" x="0.0" y="0.0" width="392" height="221"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Xjw-df-oAz">
<rect key="frame" x="98" y="155" width="276" height="17"/>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Xjw-df-oAz">
<rect key="frame" x="98" y="184" width="276" height="17"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Add offline pack" id="Iec-RB-iqn">
<font key="font" metaFont="systemBold"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="sui-dp-hbb">
<rect key="frame" x="98" y="78" width="44" height="17"/>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="sui-dp-hbb">
<rect key="frame" x="98" y="107" width="44" height="17"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="Name:" id="2El-Zw-T6E">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="D3l-hX-2Dh">
<rect key="frame" x="98" y="105" width="276" height="42"/>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="D3l-hX-2Dh">
<rect key="frame" x="98" y="134" width="276" height="42"/>
<textFieldCell key="cell" selectable="YES" title="Mapbox GL will download all the resources needed for viewing the currently visible coordinate bounds in the current style." id="3Gw-Zy-sBT">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="tUU-DX-RxU">
<rect key="frame" x="148" y="75" width="224" height="22"/>
<textField verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="tUU-DX-RxU">
<rect key="frame" x="148" y="104" width="224" height="22"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" usesSingleLineMode="YES" id="lwQ-N1-PTI">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -351,24 +352,16 @@
<outlet property="nextKeyView" destination="Xo1-tZ-WQ6" id="VIu-TG-LQu"/>
</connections>
</textField>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="p5T-3H-wqL">
<rect key="frame" x="20" y="108" width="64" height="64"/>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="p5T-3H-wqL">
<rect key="frame" x="20" y="137" width="64" height="64"/>
<constraints>
<constraint firstAttribute="height" constant="64" id="2Xy-pC-rE3"/>
<constraint firstAttribute="width" constant="64" id="SWY-Rg-9R8"/>
</constraints>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="cww-fO-sNX"/>
</imageView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="hhq-J9-mzB">
<rect key="frame" x="98" y="52" width="44" height="17"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="From:" id="fkO-YX-Yzt">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Xo1-tZ-WQ6">
<rect key="frame" x="148" y="49" width="96" height="22"/>
<textField verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Xo1-tZ-WQ6">
<rect key="frame" x="148" y="78" width="96" height="22"/>
<constraints>
<constraint firstAttribute="width" constant="96" id="8Rw-FU-HGV"/>
</constraints>
@@ -384,16 +377,16 @@
<outlet property="nextKeyView" destination="5sj-XD-neD" id="90r-pR-v8j"/>
</connections>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8r0-F0-e5i">
<rect key="frame" x="250" y="52" width="20" height="17"/>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="8r0-F0-e5i">
<rect key="frame" x="250" y="81" width="20" height="17"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="to:" id="RBS-Uj-AVT">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="5sj-XD-neD">
<rect key="frame" x="276" y="49" width="96" height="22"/>
<textField verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="5sj-XD-neD">
<rect key="frame" x="276" y="78" width="96" height="22"/>
<constraints>
<constraint firstAttribute="width" constant="96" id="faj-tE-bfc"/>
</constraints>
@@ -406,7 +399,7 @@
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<outlet property="nextKeyView" destination="tUU-DX-RxU" id="o5A-2J-9Sl"/>
<outlet property="nextKeyView" destination="Jbt-z6-eg9" id="273-nM-wgO"/>
</connections>
</textField>
<button verticalHuggingPriority="750" tag="1" translatesAutoresizingMaskIntoConstraints="NO" id="EyW-0r-iV7">
@@ -435,6 +428,25 @@ Gw
<action selector="confirmAddingOfflinePack:" target="-2" id="Ljo-bK-4BU"/>
</connections>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Jbt-z6-eg9">
<rect key="frame" x="98" y="54" width="198" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Include CJK characters" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="whL-VW-8fY">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<outlet property="nextKeyView" destination="tUU-DX-RxU" id="bQK-xN-9lx"/>
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="hhq-J9-mzB">
<rect key="frame" x="98" y="81" width="44" height="17"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="From:" id="fkO-YX-Yzt">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<constraints>
<constraint firstItem="hhq-J9-mzB" firstAttribute="firstBaseline" secondItem="Xo1-tZ-WQ6" secondAttribute="firstBaseline" id="0Rv-Ze-u9B"/>
@@ -471,7 +483,7 @@ Gw
<connections>
<outlet property="initialFirstResponder" destination="tUU-DX-RxU" id="W2D-pZ-p0s"/>
</connections>
<point key="canvasLocation" x="79" y="867"/>
<point key="canvasLocation" x="79" y="881.5"/>
</window>
</objects>
<resources>

View File

@@ -82,6 +82,7 @@ NSArray<id <MGLAnnotation>> *MBXFlattenedShapes(NSArray<id <MGLAnnotation>> *sha
@property (weak) IBOutlet NSNumberFormatter *minimumOfflinePackZoomLevelFormatter;
@property (weak) IBOutlet NSTextField *maximumOfflinePackZoomLevelField;
@property (weak) IBOutlet NSNumberFormatter *maximumOfflinePackZoomLevelFormatter;
@property (weak) IBOutlet NSButton *includesIdeographicGlyphsBox;
@end
@@ -931,6 +932,8 @@ NSArray<id <MGLAnnotation>> *MBXFlattenedShapes(NSArray<id <MGLAnnotation>> *sha
self.minimumOfflinePackZoomLevelFormatter.maximum = @(ceil(self.mapView.maximumZoomLevel));
self.maximumOfflinePackZoomLevelFormatter.maximum = @(ceil(self.mapView.maximumZoomLevel));
NSString *fontFamilyName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"MGLIdeographicFontFamilyName"];
self.includesIdeographicGlyphsBox.state = fontFamilyName ? NSOffState : NSOnState;
[self.addOfflinePackWindow makeFirstResponder:self.offlinePackNameField];
__weak __typeof__(self) weakSelf = self;
@@ -945,6 +948,7 @@ NSArray<id <MGLAnnotation>> *MBXFlattenedShapes(NSArray<id <MGLAnnotation>> *sha
bounds:strongSelf.mapView.visibleCoordinateBounds
fromZoomLevel:strongSelf.minimumOfflinePackZoomLevelField.integerValue
toZoomLevel:strongSelf.maximumOfflinePackZoomLevelField.integerValue];
region.includesIdeographicGlyphs = strongSelf.includesIdeographicGlyphsBox.state == NSOnState;
NSString *name = strongSelf.offlinePackNameField.stringValue;
if (!name.length) {
name = strongSelf.offlinePackNameField.placeholderString;