// See cairo_font_options_set_antialias().
//
// C API documentation: http://cairographics.org/manual/cairo-cairo-font-options-t.html#cairo-font-options-set-antialias
171289
func (options *FontOptions) SetAntialias(antialias Antialias) {
	C.cairo_font_options_set_antialias(options.Ptr, C.cairo_antialias_t(antialias))
	if err := options.status(); err != nil {
		panic(err)
	}
}
578096
func (options *FontOptions) SetHintMetrics(hintMetrics HintMetrics) {
	C.cairo_font_options_set_hint_metrics(options.Ptr, C.cairo_hint_metrics_t(hintMetrics))
	if err := options.status(); err != nil {
		panic(err)
	}
}
56432
func UserFontFaceCreate() *FontFace {
	ret := wrapFontFace(C.cairo_user_font_face_create())
	if err := ret.status(); err != nil {
		panic(err)
	}
	return ret
}
203857
func (s *Site) renderAliases() error {
	for _, p := range s.workAllPages {

		if len(p.Aliases()) == 0 {
			continue
		}

		for _, of := range p.OutputFormats() {
			if !of.Format.IsHTML {
				continue
			}

			plink := of.Permalink()
			f := of.Format

			for _, a := range p.Aliases() {
				isRelative := !strings.HasPrefix(a, "/")

				if isRelative {
					// Make alias relative, where "." will be on the
					// same directory level as the current page.
					// TODO(bep) ugly URLs doesn't seem to be supported in
					// aliases, I'm not sure why not.
					basePath := of.RelPermalink()
					if strings.HasSuffix(basePath, "/") {
						basePath = path.Join(basePath, "..")
					}
					a = path.Join(basePath, a)

				} else if f.Path != "" {
					// Make sure AMP and similar doesn't clash with regular aliases.
					a = path.Join(f.Path, a)
				}

				lang := p.Language().Lang

				if s.h.multihost && !strings.HasPrefix(a, "/"+lang) {
					// These need to be in its language root.
					a = path.Join(lang, a)
				}

				if err := s.writeDestAlias(a, plink, f, p); err != nil {
					return err
				}
			}
		}
	}

	return nil
}
1077308
func (f *Font) generateFontAtlas(c int) FontAtlas {
	atlas := FontAtlas{
		XLocation: make([]float32, c),
		YLocation: make([]float32, c),
		Width:     make([]float32, c),
		Height:    make([]float32, c),
	}

	currentX := float32(0)
	currentY := float32(0)

	// Default colors
	if f.FG == nil {
		f.FG = color.NRGBA{0, 0, 0, 0}
	}
	if f.BG == nil {
		f.BG = color.NRGBA{0, 0, 0, 0}
	}

	d := &font.Drawer{}
	d.Src = image.NewUniform(f.FG)
	d.Face = truetype.NewFace(f.TTF, &truetype.Options{
		Size:    f.Size,
		DPI:     dpi,
		Hinting: font.HintingNone,
	})

	lineHeight := d.Face.Metrics().Height
	lineBuffer := float32(lineHeight.Ceil()) / 2
	xBuffer := float32(10)

	for i := 0; i < c; i++ {
		_, adv, ok := d.Face.GlyphBounds(rune(i))
		if !ok {
			continue
		}
		currentX += xBuffer

		atlas.Width[i] = float32(adv.Ceil())
		atlas.Height[i] = float32(lineHeight.Ceil()) + lineBuffer
		atlas.XLocation[i] = currentX
		atlas.YLocation[i] = currentY

		currentX += float32(adv.Ceil()) + xBuffer

		if currentX > atlas.TotalWidth {
			atlas.TotalWidth = currentX
		}

		if currentX > 1024 || i >= c-1 {
			currentX = 0
			currentY += float32(lineHeight.Ceil()) + lineBuffer
			atlas.TotalHeight += float32(lineHeight.Ceil()) + lineBuffer
		}
	}

	// Create texture
	actual := image.NewNRGBA(image.Rect(0, 0, int(atlas.TotalWidth), int(atlas.TotalHeight)))
	draw.Draw(actual, actual.Bounds(), image.NewUniform(f.BG), image.ZP, draw.Src)
	d.Dst = actual

	for i := 0; i < c; i++ {
		_, _, ok := d.Face.GlyphBounds(rune(i))
		if !ok {
			continue
		}
		d.Dot = fixed.P(int(atlas.XLocation[i]), int(atlas.YLocation[i]+float32(lineHeight.Ceil())))
		d.DrawBytes([]byte{byte(i)})
	}

	imObj := NewImageObject(actual)
	atlas.Texture = NewTextureSingle(imObj).id

	return atlas
}
1366048
func (s *BurninDestinationSettings) SetFontScript(v string) *BurninDestinationSettings {
	s.FontScript = &v
	return s
}
1134534
func (rr *rasterRenderer) SetFont(f *truetype.Font) {
	rr.s.Font = f
}
1057769
func FontOptionsCreate() *FontOptions {
	ret := wrapFontOptions(C.cairo_font_options_create())
	if err := ret.status(); err != nil {
		panic(err)
	}
	return ret
}
156641
func (s *ListAliasesOutput) SetAliases(v []*AliasListEntry) *ListAliasesOutput {
	s.Aliases = v
	return s
}
1208491
func (vr *vectorRenderer) SetFont(f *truetype.Font) {
	vr.s.Font = f
}
21832
func ScaledFontCreate(fontFace *FontFace, fontMatrix, ctm *Matrix, options *FontOptions) *ScaledFont {
	ret := wrapScaledFont(C.cairo_scaled_font_create(fontFace.Ptr, (*C.cairo_matrix_t)(unsafe.Pointer(fontMatrix)), (*C.cairo_matrix_t)(unsafe.Pointer(ctm)), options.Ptr))
	if err := ret.status(); err != nil {
		panic(err)
	}
	return ret
}
427703
func (c *Client) renderOptions(opts []grpc.CallOption) (*Options, error) {
	var options *Options
	if c.Options != nil {
		cpy := *c.Options
		options = &cpy
	} else {
		options = DefaultOptions()
	}
	if err := options.apply(opts); err != nil {
		return nil, err
	}
	return options, nil
}
728790
func (options *FontOptions) SetHintStyle(hintStyle HintStyle) {
	C.cairo_font_options_set_hint_style(options.Ptr, C.cairo_hint_style_t(hintStyle))
	if err := options.status(); err != nil {
		panic(err)
	}
}
947728
func (s *DeleteAliasInput) SetAlias(v string) *DeleteAliasInput {
	s.Alias = &v
	return s
}
709116
func (rgc *RasterGraphicContext) SetFont(font *truetype.Font) {
	rgc.current.Font = font
}
596629
func (s *StreamingDistributionConfig) SetAliases(v *Aliases) *StreamingDistributionConfig {
	s.Aliases = v
	return s
}
854497
func (c *Page) SetFontFamiliesWithParams(v *PageSetFontFamiliesParams) (*gcdmessage.ChromeResponse, error) {
	return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Page.setFontFamilies", Params: v})
}