Skip to content

Commit

Permalink
Introduce experimental MapboxMap.styleGlyphURL (#2322)
Browse files Browse the repository at this point in the history
  • Loading branch information
evil159 authored Oct 8, 2024
1 parent afe43a6 commit 3055d0b
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 26 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Map().mapStyle(.standard(font: fontValue))
Map().mapStyle(.standard(font: StandardFont(rawValue: fontValue)))
Map().mapStyle(.standard(font: .lato))
```

* Introduce experimental property `MapboxMap.styleGlyphURL`. Use this property to apply custom fonts to the map at runtime, without modifying the base style.

## 11.7.0 - 26 September, 2024

Expand Down
4 changes: 2 additions & 2 deletions MapboxMaps.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Pod::Spec.new do |m|
m.source_files = 'Sources/MapboxMaps/**/*.{swift,h}'
m.resource_bundles = { 'MapboxMapsResources' => ['Sources/**/*.{xcassets,strings}', 'Sources/MapboxMaps/MapboxMaps.json', 'Sources/MapboxMaps/PrivacyInfo.xcprivacy'] }

m.dependency 'MapboxCoreMaps', '11.7.0'
m.dependency 'MapboxCommon', '24.7.0'
m.dependency 'MapboxCoreMaps', '11.8.0-SNAPSHOT.1007T0604Z.9abe2f8'
m.dependency 'MapboxCommon', '24.8.0-SNAPSHOT.1007T0604Z.9abe2f8'
m.dependency 'Turf', '3.0.0'

end
18 changes: 0 additions & 18 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
{
"pins" : [
{
"identity" : "mapbox-common-ios",
"kind" : "remoteSourceControl",
"location" : "https://github.com/mapbox/mapbox-common-ios.git",
"state" : {
"revision" : "25d2799f6116d7921b707b6eb217cf976e0a664a",
"version" : "24.7.0"
}
},
{
"identity" : "mapbox-core-maps-ios",
"kind" : "remoteSourceControl",
"location" : "https://github.com/mapbox/mapbox-core-maps-ios.git",
"state" : {
"revision" : "b191fddd85c19c7372b6a5b93bb883ba04ea0cbe",
"version" : "11.7.0"
}
},
{
"identity" : "turf-swift",
"kind" : "remoteSourceControl",
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import PackageDescription
import Foundation

let coreMaps = MapsDependency.coreMaps(version: "11.7.0")
let common = MapsDependency.common(version: "24.7.0")
let coreMaps = MapsDependency.coreMaps(version: "11.8.0-SNAPSHOT.1007T0604Z.9abe2f8", checksum: "5883a91cce09d7686c1fe3c7072f80efeb09dd9ca945d3ce4acf828f834ca16f")
let common = MapsDependency.common(version: "24.8.0-SNAPSHOT.1007T0604Z.9abe2f8", checksum: "b36c623ecbe4742c0b5956482de883c7a74d49eb49b7de64a8feefabe0dbe697")

let mapboxMapsPath: String? = nil

Expand Down
10 changes: 10 additions & 0 deletions Sources/MapboxMaps/Foundation/MapboxMap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,16 @@ public final class MapboxMap: StyleManager {
return __map.getElevationFor(coordinate)?.doubleValue
}

/// The URL that points to the glyphs used by the style for rendering text labels on the map.
///
/// This property allows setting a custom glyph URL at runtime, making it easier to
/// apply custom fonts to the map without modifying the base style.
@_spi(Experimental)
public var styleGlyphURL: String {
get { __map.getStyleGlyphURL() }
set { __map.setStyleGlyphURLForUrl(newValue) }
}

// MARK: - Camera Fitting

/// Transforms a view's frame into a set of coordinate bounds
Expand Down
12 changes: 12 additions & 0 deletions Tests/MapboxMapsTests/Foundation/MapboxMapTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,18 @@ final class MapboxMapTests: XCTestCase {
XCTAssertEqual(mapboxMap.__testingMap.getRenderWorldCopies(), renderWorldCopies)
}

func testGetStyleGlyphURL() {
let glyphURL = "test://test/test/{fontstack}/{range}.pbf"
mapboxMap.__testingMap.setStyleGlyphURLForUrl(glyphURL)
XCTAssertEqual(mapboxMap.styleGlyphURL, glyphURL)
}

func testSetStyleGlyphURL() {
let glyphURL = "test://test/test/{fontstack}/{range}.pbf"
mapboxMap.styleGlyphURL = glyphURL
XCTAssertEqual(mapboxMap.__testingMap.getStyleGlyphURL(), glyphURL)
}

func testGetCameraOptions() {
XCTAssertEqual(mapboxMap.cameraState, CameraState(mapboxMap.__testingMap.getCameraState()))
}
Expand Down
3 changes: 2 additions & 1 deletion Tests/MapboxMapsTests/SwiftUI/MapBasicCoordinatorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ extension PerformanceStatistics {
textureBytes: nil,
vertexBytes: nil,
graphicsPrograms: nil,
graphicsProgramsCreationTimeMillis: nil
graphicsProgramsCreationTimeMillis: nil,
fboSwitchCount: nil
),
perFrameStatistics: PerFrameRenderingStatistics(
topRenderGroups: [],
Expand Down
4 changes: 2 additions & 2 deletions scripts/release/packager/versions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"MapboxCoreMaps": "11.7.0",
"MapboxCommon": "24.7.0",
"MapboxCoreMaps": "11.8.0-SNAPSHOT.1007T0604Z.9abe2f8",
"MapboxCommon": "24.8.0-SNAPSHOT.1007T0604Z.9abe2f8",
"Turf": "3.0.0"
}

0 comments on commit 3055d0b

Please sign in to comment.