max number of different font atlases/textures cached FIXME: enable atlas size limitation via LRU GlText.atlasCacheSize = 64
767627
function isRegl (o) {
	return typeof o === 'function' &&
	o._gl &&
	o.prop &&
	o.texture &&
	o.buffer
}
973482
function GLTFTextureDDSExtension() {

		if ( ! THREE.DDSLoader ) {

			throw new Error( 'THREE.GLTFLoader: Attempting to load .dds texture without importing THREE.DDSLoader' );

		}

		this.name = EXTENSIONS.MSFT_TEXTURE_DDS;
		this.ddsLoader = new THREE.DDSLoader();

	}
1128151
def com_google_fonts_check_family_equal_numbers_of_glyphs(ttFonts):
  """"""
  # ttFonts is an iterator, so here we make a list from it
  # because we'll have to iterate twice in this check implementation:
  the_ttFonts = list(ttFonts)

  failed = False
  max_stylename = None
  max_count = 0
  max_glyphs = None
  for ttFont in the_ttFonts:
    fontname = ttFont.reader.file.name
    stylename = canonical_stylename(fontname)
    this_count = len(ttFont['glyf'].glyphs)
    if this_count > max_count:
      max_count = this_count
      max_stylename = stylename
      max_glyphs = set(ttFont['glyf'].glyphs)

  for ttFont in the_ttFonts:
    fontname = ttFont.reader.file.name
    stylename = canonical_stylename(fontname)
    these_glyphs = set(ttFont['glyf'].glyphs)
    this_count = len(these_glyphs)
    if this_count != max_count:
      failed = True
      all_glyphs = max_glyphs.union(these_glyphs)
      common_glyphs = max_glyphs.intersection(these_glyphs)
      diff = all_glyphs - common_glyphs
      diff_count = len(diff)
      if diff_count < 10:
        diff = ", ".join(diff)
      else:
        diff = ", ".join(list(diff)[:10]) + " (and more)"

      yield FAIL, (f"{stylename} has {this_count} glyphs while"
                   f" {max_stylename} has {max_count} glyphs."
                   f" There are {diff_count} different glyphs"
                   f" among them: {diff}")
  if not failed:
    yield PASS, ("All font files in this family have"
                 " an equal total ammount of glyphs.")
803486
@Override protected void resizeDynamicText() {
        double maxWidth = unitText.isVisible() ? width - size * 0.275 : width - size * 0.1;
        double fontSize = size * 0.12;
        valueText.setFont(Fonts.latoRegular(fontSize));
        if (valueText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(valueText, maxWidth, fontSize); }

        maxWidth = width - size * 0.7;
        fontSize = size * 0.06;
        averageText.setFont(Fonts.latoRegular(fontSize));
        if (averageText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(averageText, maxWidth, fontSize); }
        if (averageLine.getStartY() < graphBounds.getY() + graphBounds.getHeight() * 0.5) {
            averageText.setY(averageLine.getStartY() + (size * 0.0425));
        } else {
            averageText.setY(averageLine.getStartY() - (size * 0.0075));
        }

        maxWidth = width - size * 0.25;
        fontSize = size * 0.06;

        boolean customFontEnabled = tile.isCustomFontEnabled();
        Font    customFont        = tile.getCustomFont();
        Font    font              = (customFontEnabled && customFont != null) ? Font.font(customFont.getFamily(), fontSize) : Fonts.latoRegular(fontSize);

        text.setFont(font);
        if (text.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(text, maxWidth, fontSize); }
        text.relocate(width - size * 0.05 - text.getLayoutBounds().getWidth(), height - size * 0.1);

        maxWidth = width - size * 0.25;
        fontSize = size * 0.06;
        timeSpanText.setFont(Fonts.latoRegular(fontSize));
        if (timeSpanText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(timeSpanText, maxWidth, fontSize); }
        timeSpanText.relocate((width - timeSpanText.getLayoutBounds().getWidth()) * 0.5, height - size * 0.1);
    }
317859
def lazy_load_font(font_size=default_font_size):
    
    if font_size not in _font_cache:
        if _platform.startswith("darwin"):
            font_path = "/Library/Fonts/Arial.ttf"
        elif _platform.startswith("linux"):
            font_path = "/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-R.ttf"
        elif _platform.startswith("win32"):
            font_path = "C:\\Windows\\Fonts\\arial.ttf"
        _font_cache[font_size] = ImageFont.truetype(font_path, font_size)
    return _font_cache[font_size]
356362
def com_google_fonts_check_production_encoded_glyphs(ttFont, api_gfonts_ttFont):
  """"""
  cmap = ttFont['cmap'].getcmap(3, 1).cmap
  gf_cmap = api_gfonts_ttFont['cmap'].getcmap(3, 1).cmap
  missing_codepoints = set(gf_cmap.keys()) - set(cmap.keys())

  if missing_codepoints:
    hex_codepoints = ['0x' + hex(c).upper()[2:].zfill(4) for c
                      in missing_codepoints]
    yield FAIL, ("Font is missing the following glyphs"
                 " from the previous release"
                 " [{}]").format(', '.join(hex_codepoints))
  else:
    yield PASS, ('Font has all the glyphs from the previous release')
140127
function LayeredTextureCache(renderer) {
  var self = this;
  var r = self.renderer = renderer;
  var cy = r.cy;
  self.layersByLevel = {}; // e.g. 2 => [ layer1, layer2, ..., layerN ]

  self.firstGet = true;
  self.lastInvalidationTime = performanceNow() - 2 * invalidThreshold;
  self.skipping = false;
  self.eleTxrDeqs = cy.collection();
  self.scheduleElementRefinement = util(function () {
    self.refineElementTextures(self.eleTxrDeqs);
    self.eleTxrDeqs.unmerge(self.eleTxrDeqs);
  }, refineEleDebounceTime);
  r.beforeRender(function (willDraw, now$$1) {
    if (now$$1 - self.lastInvalidationTime <= invalidThreshold) {
      self.skipping = true;
    } else {
      self.skipping = false;
    }
  }, r.beforeRenderPriorities.lyrTxrSkip);

  var qSort = function qSort(a, b) {
    return b.reqs - a.reqs;
  };

  self.layersQueue = new Heap(qSort);
  self.setupDequeueing();
}
285241
def com_google_fonts_check_name_description_max_length(ttFont):
  """"""
  failed = False
  for name in ttFont['name'].names:
    if (name.nameID == NameID.DESCRIPTION and
        len(name.string.decode(name.getEncoding())) > 200):
      failed = True
      break

  if failed:
    yield WARN, ("A few name table entries with ID={} (NameID.DESCRIPTION)"
                 " are longer than 200 characters."
                 " Please check whether those entries are copyright notices"
                 " mistakenly stored in the description string entries by"
                 " a bug in an old FontLab version."
                 " If that's the case, then such copyright notices must be"
                 " removed from these entries."
                 "").format(NameID.DESCRIPTION)
  else:
    yield PASS, "All description name records have reasonably small lengths."
667492
function setupRenderBufferStorage( renderbuffer, renderTarget ) {

		_gl.bindRenderbuffer( 36161, renderbuffer );

		if ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) {

			_gl.renderbufferStorage( 36161, 33189, renderTarget.width, renderTarget.height );
			_gl.framebufferRenderbuffer( 36160, 36096, 36161, renderbuffer );

		} else if ( renderTarget.depthBuffer && renderTarget.stencilBuffer ) {

			_gl.renderbufferStorage( 36161, 34041, renderTarget.width, renderTarget.height );
			_gl.framebufferRenderbuffer( 36160, 33306, 36161, renderbuffer );

		} else {

			// FIXME: We don't support !depth !stencil
			_gl.renderbufferStorage( 36161, 32854, renderTarget.width, renderTarget.height );

		}

		_gl.bindRenderbuffer( 36161, null );

	}
488893
def numberOfXTilesAtZoom(self, zoom):
        ""
        [minRow, minCol, maxRow, maxCol] = self.getExtentAddress(zoom)
        return maxCol - minCol + 1
196096
function processTexture(map) {
      if (cachedData.textures.has(map)) {
        return cachedData.textures.get(map);
      }

      if (!outputJSON.textures) {
        outputJSON.textures = [];
      }

      var gltfTexture = {
        sampler: processSampler(map),
        source: processImage(map.image, map.format, map.flipY)
      };

      outputJSON.textures.push(gltfTexture);

      var index = outputJSON.textures.length - 1;
      cachedData.textures.set(map, index);

      return index;
    }
1336786
private void resizeStaticText() {
        double maxWidth = size * 0.455;
        double fontSize = size * 0.08082707;
        titleText.setFont(Fonts.latoBold(fontSize));
        if (titleText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(titleText, maxWidth, fontSize); }
        titleText.relocate((size - titleText.getLayoutBounds().getWidth()) * 0.5, size * 0.22180451);
    }
486906
public void resize(int maxCacheSize) {
		setMaxCacheSize(maxCacheSize);
		for (FeatureCache cache : tableCache.values()) {
			cache.resize(maxCacheSize);
		}
	}
1237852
@Override protected void resizeDynamicText() {
        double fontSize = size * 0.24;
        leftText.setFont(Fonts.latoRegular(fontSize));
        rightText.setFont(Fonts.latoRegular(fontSize));
    }
975225
@Override protected void resizeDynamicText() {
        double maxWidth = unitText.isVisible() ? width - size * 0.275 : width - size * 0.1;
        double fontSize = size * 0.24;
        valueText.setFont(Fonts.latoRegular(fontSize));
        if (valueText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(valueText, maxWidth, fontSize); }
    }
312440
def _atlas_from_images(images):
	
	import pyglet
	widest = max(img.width for img in images)
	height = sum(img.height for img in images)

	atlas = pyglet.image.atlas.TextureAtlas(
		width=_nearest_pow2(widest), height=_nearest_pow2(height))
	textures = [atlas.add(image) for image in images]
	return atlas, textures
1199934
def com_google_fonts_check_glyphnames_max_length(ttFont):
  """"""
  if ttFont.sfntVersion == b'\x00\x01\x00\x00' and ttFont.get(
      "post") and ttFont["post"].formatType == 3.0:
    yield PASS, ("TrueType fonts with a format 3.0 post table contain no "
                 "glyph names.")
  else:
    failed = False
    for name in ttFont.getGlyphOrder():
      if len(name) > 109:
        failed = True
        yield FAIL, ("Glyph name is too long:" " '{}'").format(name)
    if not failed:
      yield PASS, "No glyph names exceed max allowed length."