Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Distant line-placed labels are illegible when top padding is large #15167

Open
1ec5 opened this issue Jul 19, 2019 · 1 comment
Open

Distant line-placed labels are illegible when top padding is large #15167

1ec5 opened this issue Jul 19, 2019 · 1 comment
Assignees
Labels
bug Core The cross-platform C++ core, aka mbgl GL JS parity For feature parity with Mapbox GL JS text rendering

Comments

@1ec5
Copy link
Contributor

1ec5 commented Jul 19, 2019

With certain combinations of aspect ratios, content insets, and pitch (tilt), distant line-placed labels toward the top of the map are scrunched up with insufficient pitch (letter spacing).

iPhone X

Illegible road labels from top to bottom: Linn St, Gest St, Plum St, Home Alley, Elm St, Race St, Central Ave, Vine St, Walnut St


iPhone 8

Millbrook Dr, Cooper Rd, Este Ave, Vera Ave, Quatman Ave


iPhone 8

W McMillan Ave, Warner St, Ravine St


CarPlay

Gest St, Egan Alley, Home Alley


CarPlay

Elsinore Ave, Celestial St, Monastery St, Eggleston Ave


Steps to reproduce

Apply this patch to iosapp and run on iPhone X:

diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m
index 2fb95e1b17..29213f89b1 100644
--- a/platform/ios/app/MBXViewController.m
+++ b/platform/ios/app/MBXViewController.m
@@ -1958,7 +1958,7 @@ CLLocationCoordinate2D randomWorldCoordinate() {
     static dispatch_once_t onceToken;
     dispatch_once(&onceToken, ^{
         styleNames = @[
-            @"Streets",
+            @"Navigation Guidance Day",
             @"Outdoors",
             @"Light",
             @"Dark",
@@ -1966,7 +1966,7 @@ CLLocationCoordinate2D randomWorldCoordinate() {
             @"Satellite Streets",
         ];
         styleURLs = @[
-            [MGLStyle streetsStyleURL],
+            [NSURL URLWithString:@"mapbox://styles/mapbox/navigation-guidance-day-v4"],
             [MGLStyle outdoorsStyleURL],
             [MGLStyle lightStyleURL],
             [MGLStyle darkStyleURL],
@@ -2253,6 +2253,12 @@ CLLocationCoordinate2D randomWorldCoordinate() {
     // that a device with an English-language locale is already effectively
     // using locale-based country labels.
     _localizingLabels = [[self bestLanguageForUser] isEqualToString:@"en"];
+    
+    self.automaticallyAdjustsScrollViewInsets = NO;
+    self.mapView.contentInset = UIEdgeInsetsMake(CGRectGetHeight(self.mapView.bounds) * 0.6, 0, 0, 0);
+    MGLMapCamera *camera = [MGLMapCamera cameraLookingAtCenterCoordinate:CLLocationCoordinate2DMake(39.099392, -84.514483) altitude:196 pitch:60 heading:260];
+    UIEdgeInsets padding = UIEdgeInsetsMake(CGRectGetHeight(self.mapView.bounds) * 0, CGRectGetWidth(self.mapView.bounds) * 0, CGRectGetHeight(self.mapView.bounds) * 0, CGRectGetWidth(self.mapView.bounds) * 0);
+    [self.mapView setCamera:camera withDuration:0 animationTimingFunction:nil edgePadding:padding completionHandler:nil];
 }
 
 - (BOOL)mapView:(MGLMapView *)mapView shouldChangeFromCamera:(MGLMapCamera *)oldCamera toCamera:(MGLMapCamera *)newCamera {

Some styles like the Navigation Guidance Day v4 style seem to exacerbate the issue, but it can be observed in Streets too.

Diagnosis

This issue is most readily reproducible in tall views with a large top content inset. This can easily happen when the iOS navigation SDK runs on an iPhone X or on certain CarPlay units: mapbox/mapbox-navigation-ios#2184. The navigation SDK happens to apply a large top padding rather than a large top content inset when tracking the user’s location, in order to control the puck’s position, but the effect is the same.

On the surface, the issue would seem to be related to #15163. However, I think it’s actually that label size attenuation (mapbox/mapbox-gl-js#4547 mapbox/mapbox-gl-js#4781) doesn’t account for viewing distance (mapbox/mapbox-gl-js#5086), and the issue is exacerbated by the content inset, now that the map’s focal point is shifted lower.

Configuration

Mapbox SDK versions: v5.1.0 but not v5.0.0
iOS/macOS versions: iOS 12.2
Device/simulator models: CarPlay simulator with iPhone 8 simulator, iPhone X simulator
Xcode version: 10.2.1

/ref @mapbox/maps-ios @mapbox/gl-core @mapbox/navigation-ios @d-prukop

@1ec5 1ec5 added bug text rendering Core The cross-platform C++ core, aka mbgl labels Jul 19, 2019
@astojilj astojilj self-assigned this Jul 23, 2019
@astojilj astojilj added the GL JS parity For feature parity with Mapbox GL JS label Aug 19, 2019
@astojilj
Copy link
Contributor

GL JS parity is added

While porting the work to GL.JS, noticed that the issue with text placement doesn't exist with GL.JS.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Core The cross-platform C++ core, aka mbgl GL JS parity For feature parity with Mapbox GL JS text rendering
Projects
None yet
Development

No branches or pull requests

2 participants