Last active
January 2, 2016 14:29
-
-
Save stpe/8316832 to your computer and use it in GitHub Desktop.
Code to reproduce GTextOverflowModeFill bug when word is wrapped starting with lowercase 'j' (using PebbleSDK-2.0-BETA4)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Complete buildable project containing minimum sample code to reproduce bug: | |
https://dl.dropboxusercontent.com/u/20181/TextOverflowModeFill-bug.zip | |
Bug description: | |
Using a TextLayer with GTextOverflowModeFill seems to position the | |
leading 'j' out of place in wrapped words starting with 'j'. | |
Example screenshot of the 'j' out of place: | |
https://dl.dropboxusercontent.com/u/20181/pebble-screenshot_2014-01-08_14-28-07.png | |
Example when switching place between the 'j' and 'o', or using capital 'J', does not trigger bug: | |
https://dl.dropboxusercontent.com/u/20181/pebble-screenshot_2014-01-08_14-29-08.png | |
https://dl.dropboxusercontent.com/u/20181/pebble-screenshot_2014-01-08_14-31-00.png | |
{ | |
"releaseChannel": "RELEASE", | |
"deviceBrand": "samsung", | |
"deviceKernel": "3.0.31-1153417", | |
"deviceManufacturer": "samsung", | |
"deviceModel": "GT-I9305", | |
"osVersion": "4.1.2", | |
"pebbleAppVersion": "2.0-BETA4 - g4e60a73", | |
"pebbleBTAddress": "0017EC1C23FB", | |
"pebbleFwVersion": "v2.0-BETA4", | |
"pebbleRecoveryVersion": "v1.5.4", | |
"pebbleSerialNumber": "3350111C23FB", | |
"accessibilityServiceEnabled": true, | |
"sdkVersion": 16 | |
} | |
Pebble log available: https://dl.dropboxusercontent.com/u/20181/pebble-TextOverflowModeFill-bug.log.gz | |
// stefpet@gmail.com | |
*/ | |
#include <pebble.h> | |
static Window *window; | |
static TextLayer *text_layer; | |
static void window_load(Window *window) { | |
Layer *window_layer = window_get_root_layer(window); | |
GRect bounds = layer_get_bounds(window_layer); | |
// Note how the 'j' character is out of place when a word starting with 'j' is | |
// wrapped. Changing place so it says "ojurnalisterna" does not trigger the bug, | |
// nor using a capital 'J' | |
text_layer = text_layer_create((GRect) { .origin = { 1, bounds.size.h - 48 }, .size = { bounds.size.w - 2, 50 } }); | |
text_layer_set_text(text_layer, "13:34 Just nu: Kidnappade journalisterna frigivna"); | |
text_layer_set_text_color(text_layer, GColorWhite); | |
text_layer_set_background_color(text_layer, GColorBlack); | |
text_layer_set_overflow_mode(text_layer, GTextOverflowModeFill); | |
text_layer_set_font(text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD)); | |
layer_add_child(window_layer, text_layer_get_layer(text_layer)); | |
} | |
static void window_unload(Window *window) { | |
text_layer_destroy(text_layer); | |
} | |
static void init(void) { | |
window = window_create(); | |
window_set_window_handlers(window, (WindowHandlers) { | |
.load = window_load, | |
.unload = window_unload, | |
}); | |
const bool animated = true; | |
window_stack_push(window, animated); | |
} | |
static void deinit(void) { | |
window_destroy(window); | |
} | |
int main(void) { | |
init(); | |
APP_LOG(APP_LOG_LEVEL_DEBUG, "Done initializing, pushed window: %p", window); | |
app_event_loop(); | |
deinit(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment