//AddTTFFontByReaderWithOption add font file
16608
func (gp *GoPdf) AddTTFFontByReaderWithOption(family string, rd io.Reader, option TtfOption) error {
	subsetFont := new(SubsetFontObj)
	subsetFont.init(func() *GoPdf {
		return gp
	})
	subsetFont.SetTtfFontOption(option)
	subsetFont.SetFamily(family)
	err := subsetFont.SetTTFByReader(rd)
	if err != nil {
		return err
	}

	unicodemap := new(UnicodeMap)
	unicodemap.init(func() *GoPdf {
		return gp
	})
	unicodemap.setProtection(gp.protection())
	unicodemap.SetPtrToSubsetFontObj(subsetFont)
	unicodeindex := gp.addObj(unicodemap)

	pdfdic := new(PdfDictionaryObj)
	pdfdic.init(func() *GoPdf {
		return gp
	})
	pdfdic.setProtection(gp.protection())
	pdfdic.SetPtrToSubsetFontObj(subsetFont)
	pdfdicindex := gp.addObj(pdfdic)

	subfontdesc := new(SubfontDescriptorObj)
	subfontdesc.init(func() *GoPdf {
		return gp
	})
	subfontdesc.SetPtrToSubsetFontObj(subsetFont)
	subfontdesc.SetIndexObjPdfDictionary(pdfdicindex)
	subfontdescindex := gp.addObj(subfontdesc)

	cidfont := new(CIDFontObj)
	cidfont.init(func() *GoPdf {
		return gp
	})
	cidfont.SetPtrToSubsetFontObj(subsetFont)
	cidfont.SetIndexObjSubfontDescriptor(subfontdescindex)
	cidindex := gp.addObj(cidfont)

	subsetFont.SetIndexObjCIDFont(cidindex)
	subsetFont.SetIndexObjUnicodeMap(unicodeindex)
	index := gp.addObj(subsetFont) //add หลังสุด

	if gp.indexOfProcSet != -1 {
		procset := gp.pdfObjs[gp.indexOfProcSet].(*ProcSetObj)
		if !procset.Realtes.IsContainsFamilyAndStyle(family, option.Style&^Underline) {
			procset.Realtes = append(procset.Realtes, RelateFont{Family: family, IndexOfObj: index, CountOfFont: gp.curr.CountOfFont, Style: option.Style &^ Underline})
			subsetFont.CountOfFont = gp.curr.CountOfFont
			gp.curr.CountOfFont++
		}
	}
	return nil
}
167851
func (f *Fpdf) loadfont(r io.Reader) (def fontDefType) {
	if f.err != nil {
		return
	}
	// dbg("Loading font [%s]", fontStr)
	var buf bytes.Buffer
	_, err := buf.ReadFrom(r)
	if err != nil {
		f.err = err
		return
	}
	err = json.Unmarshal(buf.Bytes(), &def)
	if err != nil {
		f.err = err
		return
	}

	if def.i, err = generateFontID(def); err != nil {
		f.err = err
	}
	// dump(def)
	return
}
531311
func (s *BurnInDestinationSettings) SetFontColor(v string) *BurnInDestinationSettings {
	s.FontColor = &v
	return s
}
706605
func (p *parser) addText(text string) {
	if text == "" {
		return
	}

	if p.shouldFosterParent() {
		p.fosterParent(&Node{
			Type: TextNode,
			Data: text,
		})
		return
	}

	t := p.top()
	if n := t.LastChild; n != nil && n.Type == TextNode {
		n.Data += text
		return
	}
	p.addChild(&Node{
		Type: TextNode,
		Data: text,
	})
}
960166
func (s *UsageService) AddTrafficType(p *AddTrafficTypeParams) (*AddTrafficTypeResponse, error) {
	resp, err := s.cs.newRequest("addTrafficType", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r AddTrafficTypeResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	// If we have a async client, we need to wait for the async result
	if s.cs.async {
		b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
		if err != nil {
			if err == AsyncTimeoutErr {
				return &r, err
			}
			return nil, err
		}

		b, err = getRawValue(b)
		if err != nil {
			return nil, err
		}

		if err := json.Unmarshal(b, &r); err != nil {
			return nil, err
		}
	}

	return &r, nil
}
209760
func (d *DropDown) SetPrefixTextColor(color tcell.Color) *DropDown {
	d.prefixTextColor = color
	return d
}
1282296
func AddMatcher(fileType types.Type, matcher matchers.Matcher) matchers.TypeMatcher {
	return matchers.NewMatcher(fileType, matcher)
}
48621
func (mc MongoClient) AddReading(r contract.Reading) (string, error) {
	s := mc.getSessionCopy()
	defer s.Close()

	var mapped models.Reading
	id, err := mapped.FromContract(r)
	if err != nil {
		return "", err
	}

	mapped.TimestampForAdd()

	err = s.DB(mc.database.Name).C(db.ReadingsCollection).Insert(&mapped)
	if err != nil {
		return "", errorMap(err)
	}
	return id, err
}
934329
func (s *SubsetFontObj) SetTTFByPath(ttfpath string) error {
	useKerning := s.ttfFontOption.UseKerning
	s.ttfp.SetUseKerning(useKerning)
	err := s.ttfp.Parse(ttfpath)
	if err != nil {
		return err
	}
	return nil
}
1162097
func (s *Set) AddOption(o Option) {
	opt := o.(*option)
	for _, eopt := range s.options {
		if opt == eopt {
			return
		}
	}
	if opt.short != 0 {
		if oo, ok := s.shortOptions[opt.short]; ok {
			fmt.Fprintf(stderr, "%s: -%c already declared at %s\n", opt.where, opt.short, oo.where)
			exit(1)
		}
		s.shortOptions[opt.short] = opt
	}
	if opt.long != "" {
		if oo, ok := s.longOptions[opt.long]; ok {
			fmt.Fprintf(stderr, "%s: --%s already declared at %s\n", opt.where, opt.long, oo.where)
			exit(1)
		}
		s.longOptions[opt.long] = opt
	}
	s.options = append(s.options, opt)
}
512130
func (c *Client) AddReading(r contract.Reading) (id string, err error) {
	conn := c.Pool.Get()
	defer conn.Close()

	if r.Id != "" {
		_, err = uuid.Parse(r.Id)
		if err != nil {
			return "", db.ErrInvalidObjectId
		}
	}
	return addReading(conn, true, r)
}
805718
func (assembly *Assembly) AddReader(fieldname, filename string, reader io.ReadCloser) {
	assembly.readers = append(assembly.readers, &upload{
		Field:  fieldname,
		Name:   filename,
		Reader: reader,
	})
}
187031
func (s *ServiceOfferingService) GetServiceOfferingByName(name string, opts ...OptionFunc) (*ServiceOffering, int, error) {
	id, count, err := s.GetServiceOfferingID(name, opts...)
	if err != nil {
		return nil, count, err
	}

	r, count, err := s.GetServiceOfferingByID(id, opts...)
	if err != nil {
		return nil, count, err
	}
	return r, count, nil
}
1060265
func (s *DvbSubDestinationSettings) SetFontColor(v string) *DvbSubDestinationSettings {
	s.FontColor = &v
	return s
}
449358
func (f *Fpdf) RegisterImageReader(imgName, tp string, r io.Reader) (info *ImageInfoType) {
	options := ImageOptions{
		ReadDpi:   false,
		ImageType: tp,
	}
	return f.RegisterImageOptionsReader(imgName, options, r)
}
1373332
func (gp *GoPdf) CellWithOption(rectangle *Rect, text string, opt CellOption) error {
	rectangle = rectangle.UnitsToPoints(gp.config.Unit)
	err := gp.curr.Font_ISubset.AddChars(text)
	if err != nil {
		return err
	}
	err = gp.getContent().AppendStreamSubsetFont(rectangle, text, opt)
	if err != nil {
		return err
	}
	return nil
}
389634
func (s *service) AddWithProfile(reqDTO rest.RequestDTOWithProfile) (rest.ResponseDTOWithProfile, *servicehelper.Error) {
	if _, err := s.Add(rest.RequestDTO{
		Email:    reqDTO.Email,
		Username: reqDTO.Username,
		Password: reqDTO.Password,
	}); err != nil {
		return rest.ResponseDTOWithProfile{}, err
	}
	resDTO, apiErrors, statusCode := callPostProfileService(reqDTO)
	if statusCode != http.StatusCreated {
		s.Remove(reqDTO.Email)
		if len(apiErrors.Errors) > 0 {
			return rest.ResponseDTOWithProfile{}, &servicehelper.Error{
				Detail:  errors.New(apiErrors.Errors[0].(apihelper.Error).Detail),
				Message: apiErrors.Errors[0].(apihelper.Error).Message,
				Param:   apiErrors.Errors[0].(apihelper.Error).Param,
				Code:    servicehelper.Code(statusCode),
			}
		}
		return rest.ResponseDTOWithProfile{}, &servicehelper.Error{
			Detail:  errors.New("server unavailable"),
			Message: "Please try again later",
			Code:    servicehelper.UnexpectedError,
		}
	}
	return resDTO, nil
}