<commit_before>// NOCOMPILE
/* global labelgun, labelSegment, textPath */
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.extent');
goog.require('ol.format.OSMXML');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector');
goog.require('ol.source.BingMaps');
goog.require('ol.source.Vector');
goog.require('ol.style.Style');

var emptyFn = function() {};
var labelEngine = new labelgun['default'](emptyFn, emptyFn);

var context, pixelRatio; // Will be set in the map's postcompose listener
function measureText(text) {
  return context.measureText(text).width * pixelRatio;
}

var extent, letters; // Will be set in the style's renderer function
function collectDrawData(letter, x, y, angle) {
  ol.extent.extendCoordinate(extent, [x, y]);
  letters.push([x, y, angle, letter]);
}

var style = new ol.style.Style({
  renderer: function(coords, geometry, feature) {
    var text = feature.get('name');
    if (text) {
      // Only create label when geometry has a long and straight segment
      var path = labelSegment(coords, Math.PI / 8, measureText(text));
      if (path) {
        extent = ol.extent.createEmpty();<commit_msg>Only use API functions in example<commit_after>// NOCOMPILE
/* global labelgun, labelSegment, textPath */
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.extent');
goog.require('ol.format.OSMXML');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector');
goog.require('ol.source.BingMaps');
goog.require('ol.source.Vector');
goog.require('ol.style.Style');

var emptyFn = function() {};
var labelEngine = new labelgun['default'](emptyFn, emptyFn);

var context, pixelRatio; // Will be set in the map's postcompose listener
function measureText(text) {
  return context.measureText(text).width * pixelRatio;
}

var extent, letters; // Will be set in the style's renderer function
function collectDrawData(letter, x, y, angle) {
  ol.extent.extend(extent, [x, y, x, y]);
  letters.push([x, y, angle, letter]);
}

var style = new ol.style.Style({
  renderer: function(coords, geometry, feature) {
    var text = feature.get('name');
    if (text) {
      // Only create label when geometry has a long and straight segment
      var path = labelSegment(coords, Math.PI / 8, measureText(text));
      if (path) {
        extent = ol.extent.createEmpty();
{'fraction_non_alphanumeric': 0.1569468267581475, 'fraction_numerical': 0.0008576329331046312, 'mean_word_length': 4.502358490566038, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2100420', 'n_tokens_mistral': 758, 'n_tokens_neox': 739, 'n_words': 198}